confounded by a simple shell script
Scott Queen <[email protected]>
| Newsgroups | gmane.linux.redhat.release.enigma |
|---|---|
| Message-ID | <[email protected]> |
All, I'm using RHL 7.3, and I've got a couple of very simple shell scripts - one of which is kicking my butt. I just don't understand what it is/isn't doing. Here are the details ==================================== Script that works fine: dokimos_web:logs>more combQV.sh cp qvcatering_access.log qvcatering_access.log.bak for i in `ls -rt qvcatering_access_log.2*.log`; do cat $i >> qvcatering_access.log; done mv qvcatering_access_log.2*.log saved =========================================== Script (computeStats.sh) that doesn't work and it's output (Version 1): # set environment variables ./home/dokimos_web/.bash_profile # TC defined in .bash_profile file echo $TC exit 0 ---------------------------------- results: dokimos_web:logs>./computeStats.sh : No such file or directoryokimos_web/.bash_profile '/computeStats.sh: exit: bad non-numeric arg `0 dokimos_web:logs> [note: the apparent truncation/overwriting in the "No such file or directoryokimos_web" line is not a typo on my part - that's the actual output] ================================================= Script (computeStats.sh) that doesn't work and it's output (Version 2): #!/bin/bash # set environment variables ./home/dokimos_web/.bash_profile echo $TC exit 0 ------------------------------ results: dokimos_web:logs>./computeStats.sh bash: ./computeStats.sh: bad interpreter: No such file or directory dokimos_web:logs> =========================================== I've checked, and bash is in /bin. So.... I have a couple of questions: 1. why isn't the #!/bin/bash line required in the script that works? 2. why doesn't the other script work? [note that computeStats.sh has executable permissions for all users] Thanks, Scott __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com