Need help writing an Unix AIX Script

jbloggs

Senior member
Jul 3, 2001
345
0
0
I have a text file 'myfilelist 'in a unix directory (/tmp) that has a list of files including full path , e.g.

/usr/file1
/mydir/file2
/myapp/file3

I need a script (Unix AIX) that will read each of those lines from the myfilelist file and do an ls -al for each one. How can this be done using unix script?

TIA
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
There's no such thing as "unix script" you need to pick a shell in which to write the script. Normally this is one of bourne (/bin/sh), C (/bin/csh) or Korn (/bin/ksh).
 

jbloggs

Senior member
Jul 3, 2001
345
0
0
Originally posted by: Nothinman
There's no such thing as "unix script" you need to pick a shell in which to write the script. Normally this is one of bourne (/bin/sh), C (/bin/csh) or Korn (/bin/ksh).

I'm using /bin/ksh.

Thanks
 

jbloggs

Senior member
Jul 3, 2001
345
0
0
Originally posted by: n0cmonkey
What have you got so far?

From looking around, I put together the following

for var in 'cat myfilelist'
do
'ls -al ' $var
done

This did not work as it gave me error that cat & myfilelist do not exist. I put the script in same dir as myfilelist.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: jbloggs
Originally posted by: n0cmonkey
What have you got so far?

From looking around, I put together the following

for var in 'cat myfilelist'
do
'ls -al ' $var
done

This did not work as it gave me error that cat & myfilelist do not exist. I put the script in same dir as myfilelist.

You don't want to use single quotes around "cat myfilelist." In fact, you don't want quotes at all. :)