I cannot move a my file into my archives directory in my bash scrip
[asy@backnew auto_cron]$ ./journal_ifms
mv: cannot stat `CUSTOMS*': No such file or directory standard in must be a tty |
What's the offending command line in your Script?
Lou |
Hi, paste the relevant section of your script. At first glance, this seems as though CUSTOMS might be a variable, but you give it to bash as a path...
Also a wildcard ('*') in a filename isn't a good idea. Serafean |
mv: cannot stat `CUSTOMS*': No such file or directory standard in must be a tty
su - asy -c /home/asy/auto_cron/test1.sql
customs=CUSTOMS* mv $customs /home/asy/auto_cron/archives/ cat /home/asy/auto_cron/test1.sql | su - asy sqlplus -s / >/dev/null cd /home/asy/auto_cron/log date "+begifms%y%m%d_%H%M" > mydate TEMPFILE=`grep "$mydate" mydate` export TEMPFILE touch ${TEMPFILE} date "+endifms%y%m%d_%H%M" > mydate TEMPFILE=`grep "$mydate" mydate` export TEMPFILE touch ${TEMPFILE} rm mydate > /dev/null |
Please explain what this line in your code is supposed to be doing (according to your thoughts):
Quote:
|
In a bash script, anything that executes is in a subshell. So, you must make some statement as to where CUSTOMS is, like this:
CUSTOMS=$HOME/customs Then the subshell executing mv will know where to look. And for cd you need a CDHOME= line. |
customs=CUSTOMS*
My idea is to make the content of CUSTOMS public / available in order for me to ble to mv it. I have tried export customs and it does not work.
|
Anything that is set in your script will only work in that subshell (and if exported, maybe, for some childs of that subshell). Exporting a variable doesn't make it usable backwards, in parent shells.
If you want the vars of your script to be dumped literally into your current shell you need to source your script using either the "source" command or a dot. Code:
$ source my_script.sh |
All times are GMT -5. The time now is 02:25 AM. |