Help - Search - Members - Calendar
Full Version: LINUX script
Linuxhelp > Support > Technical Support
Problem summary: LINUX scripting

Problem description:
ls CA*.DAT cat > cfiles.txt

The above was place within a shell script but the
file was created with as cfiles.txt? and is
unreadable. Can you tell me how I can correct this
problem. The mail is sent if I run
$ ls CA*.DAT cat > cfiles.txt from the command prompt to create the and then run the script.

complete script below
# Cat Files for OCAS
ls CA*.DAT >/u03/banjobs/cfile.txt
mail -s "CANA Files" < cfile.txt
I found the bug.
The line should be
ls CA*.DAT >'/u03/banjobs/cfile.txt'

while ls CA*.DAT >/u03/banjobs/cfile.txt will work from the prompt, it will not work from within a script.
Try adding a cd line to change to the directory that you want to be in first. Also, make sure that you are actually using bash as the shell that you're testing things on.

This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2018 Invision Power Services, Inc.