![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| read is not pausing to read | davegerdt | Shell Programming and Scripting | 3 | 04-07-2008 10:20 AM |
| ls while read loop - internal read picking up wrong input | dkieran | Shell Programming and Scripting | 2 | 05-14-2007 03:02 PM |
| Cannot read in variable using read on first try | normie | UNIX for Advanced & Expert Users | 1 | 10-05-2005 01:42 AM |
| read line and read next | ariuscy | UNIX for Dummies Questions & Answers | 7 | 09-21-2005 07:04 AM |
| read() | Deepa | IP Networking | 1 | 06-07-2002 08:50 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
While/Read
Hi,
I am trying to read all the files in a directory into an array, in different stages. However the code below: #Checks the SQL Directory for files to be released #Do the Packages Specification before the bodies counter=0 while read packageSpecName do packageSpecs[$counter]=`basename $packageSpecName` counter=$counter+1 done < `ls ${sqlDirectory}/*.pks` Does not work, it gives an error almost like it is trying to execute the files in the directory instead of save them to the array. Error: ./release.sh[15]: /usr/home/oracle92/sosa/scripts/rep.pks^J/usr/home/oracle92/sosa/scripts/test.pks: cannot open Any idea what I am doing wrong? Thanks |
|
||||
|
Quote:
`ls file` expands to the list of selected files and done < `ls files` with the above, while is reading from the selected files and from the list of files |
|
||||
|
Kinda of the back of this, and not sure if it should be in a seperate post. But if they ls does not find any files I get the following outputted to the screen:
/usr/home/oracle92/sosa/scripts/*.trc: No such file or directory I would rather it did nothing, is it possible to make a check for files before using the ls? As 'ls' is really the only way I know of doing it. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|