If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
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 /u01/dev/oracle/blake/procedures/sales/*.sh'; do
echo $file
done
Hello gjs123,
I get the same message when the path is not correctly or the file does not exist . If the path and the named files exist, your script will work. Please check the pathname and the existing files named in your wildcards.
__________________
Greetings from germany
Peter F.
The problem is because your ls command is within single quotes. You are attempting to do this exercise using command substitution and the syntax for that is $(command) or `command` (note the `` backticks are not quotes).
This is NOT the best way to perfom this exercise IMHO. You should take advantage of filename expansion through globbing.
e.g.
for filename in * ; do ...
rather than
for filename in $(ls *); do ...
Read the thread I posted and all will become clear ;-)