I have a procedure that creates two files only one of theses files is created at a time depending on if there was an error or not, what I need to do is to search a specified directory and pickup the name of the file that is in there and then be able to store this a a variable so that the script can then just pass in the variable to see which script to run next.
I have tried something like this
#!/bin/bash
for file in 'ls /u1/dev/procedures/sales/*.sh'; do
echo $file
done
###########
but all i get returned is
'ls /u1/dev/procedures/sales/<filename>.sh'
All I need returned is just the filename.
Do a man on
basename
dirname
You don't need 'ls' or quotes. Try:
for file in /u1/dev/procedures/sales/*.sh
do
echo $file
done
Quick Links:
Do you have
a UNIX Question?
Unix Home: Unix System Administration
Hints and Tips