Sample Header Ad - 728x90

Incorrect folder name created when using cp command in bash

1 vote
0 answers
119 views
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/
Asked by user601459 (19 rep)
Feb 9, 2024, 07:41 AM
Last activity: Feb 9, 2024, 01:21 PM