bash script - don't understand error
1 Attachment(s)
I wrote my first shell script to copy files for backup:
#!/bin/bash cp /media/A2AC7FD5AC7FA289/zip/Rohan.ts /media/KINGSTON/Store cp /media/KINGSTON/Store/roback.tc /media/A2AC7FD5AC7FA289/zip The commands work when typed individually at a terminal, but when I run the script, I get an error about 'invalid argument', because it seems that \r has been appended to the original line. See attached screenshot. What am I missing? |
Wrong Slash probably?
I just had a quick look and the first thing I noticed is you got a forward slash instead of a Backward slash, try changing that and see if it works.
Mohit Quote:
|
did you edit the script in windows.
ms new-lines are different from *-nix new-lines. |
Code:
cp /media/A2AC7FD5AC7FA289/zip/Rohan.ts /media/KINGSTON/Store Code:
cp /media/A2AC7FD5AC7FA289/zip/Rohan.ts /media/KINGSTON/Store |
That solved it!
It was indeed the problem with Windows line endings instead of Linux.
|
All times are GMT -5. The time now is 11:19 AM. |