I would like to copy a file from one location to another. When I use the cp command in a terminal it works well, for example I use the following command:
cp -r projects/Test/ projects/Personal/ This leads to a creation of the folder Test in the folder Personal containing all contents of Test in the folder projects. However when I execute the same line in a bash file, instead of having a folder named Test in Personal I have a folder named ~. The contents of the file are correct.
Would you know how I could have the folder named Test instead of ~? This is the code of my bash file:
#!/bin/sh cp -r projects/Test/ projects/Personal/
cp, it only comes up with the backup options (e.g.cp --backup foo.txt bar.txteffectively renamesbar.txttobar.txt~and then does the copy). How it could produce a file named just~, that's harder to understand. I think this would be a case where it would be useful to see exactly the files before and after, and the exact commands used. Better, a set of commands that could be used to replicate the issue, starting from creating the files, etc. You can edit your question from the link below it.something~or just~? Did you run thecpcommand against the same target directory several times?lsbefore and after showing the result? And please also tell us what operating system you are using. What you describe is very strange so I suspect there must be something more going on./bin/shbut your question refers tobash. Which shell are you intending to use?