Results 1 to 2 of 2
I have a script that I am running that copies files from one source folder to a destination folder.
The script is in a crontab file it's only function is ...
- 02-06-2012 #1Just Joined!
- Join Date
- Feb 2012
- Posts
- 1
cd command in shell script returns: No such file or directory
I have a script that I am running that copies files from one source folder to a destination folder.
The script is in a crontab file it's only function is to copy files
Within the script, I perform a change directory to the /tmp folder and execute the cp command to copy the file
cd /tmp
cp cputest_donotremove.txt /apps/opt/archive/tmp/demo/staging/encrypt01.tmp
cp cputest_donotremove.txt /apps/opt/archive/tmp/demo/staging/encrypt02.tmp
This is the result:
[seeuser staging]$ ./movefiles.sh
: No such file or directory /tmp
Any idea why the cd command fails? the /tmp directory exists, in the correct case and spelling so that is not the issue. I've also tried
typing this using UltraEdit, notepad, and even vi editor on the linux box; Gives the same result.
Why is Linux not able to process the cd statement?
Thanks,
Corey
- 02-07-2012 #2
The shebang is missing.
Without it, the program loader doesnt know which interpreter (bash, tcsh, perl, python, ruby, etc) to call with this textfile as argument.
Use this as the first line:
Also: Make sure, that you use unix style line feeds.Code:#!/usr/bin/env bash
You must always face the curtain with a bow.


Reply With Quote