Help - Search - Members - Calendar
Full Version: LINUX script
Linuxhelp > Support > Technical Support
als7sda
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
#!/bin/bash
# Cat Files for OCAS
ls CA*.DAT >/u03/banjobs/cfile.txt
mail -s "CANA Files" halon@banederaa.com < cfile.txt
als7sda
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.
DS2K3
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.

D
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-2017 Invision Power Services, Inc.