Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

282
Visualizações
When I try to run my bash script it throws me an error like this
case $choice in
1)
read -p "Enter the file to copy:" file
read -p "Enter the new file name:" newfile
$(cp file newfile)

;;

2)
read -p "Enter the file to move:" mvfile
read -p "Enter the file where to move:" newmv
$(mv mvfile newmv)

;;

3)
read -p "Enter the file name to remove:" filenm
$(rm filenm)

;;
esac

Error:

What do you want to do:
1) To copy from one file to another file
2) To move a file
3) To remove a file
**********************************************
Enter the choice:1
Enter the file to copy:common.txt
Enter the new file name:clone.txt
cp: cannot stat 'file': No such file or directory
root@root1-VirtualBox:/home/root1# 

(when I try to run this it throws me an error like this !!)

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

file and newfile are variables, you need to address them with a $:

$(cp $file $newfile)
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda