Computing.Net > Forums > Unix > Help Unix Script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help Unix Script

Reply to Message Icon

Name: avhg1
Date: April 26, 2004 at 05:41:03 Pacific
OS: XP
CPU/Ram: 512
Comment:

Can anyone tell me what I'm doing wrong? All my output files are blank. Any suggestions would be great.

#check for arguements & exit if none are supplied
if test $# -lt 1 ; then
echo "No file pattern supplied"
else
PStr= echo "$@" |tr " " "|"
#echo $PStr
#ls -l > tmp1
#ls -l > tmp2
ls -l | egrep '$PStr'| tr -s " "| cut -f9 -d" " > tmp1
ls -l |egrep '$PStr' | tr -s " " | cut -f1,5 -d" " | paste - tmp1 > tmp2
ls -lu |egrep '$PStr' |tr -s " " |cut -f6,7,8 -d" " |paste - tmp2 > tmp1
ls -l |egrep '$PStr' |tr -s " "|cut -f6,7,8 -d" " |paste - tmp1 > tmp2
echo "Modified Accessed Permission Size Name"
cat tmp2
#rm tmp1
#rm tmp2
fi

Thanks,
Mike



Sponsored Link
Ads by Google

Response Number 1
Name: thepubba
Date: April 26, 2004 at 08:22:54 Pacific
Reply:

Use > to create your file. Use >> to add to it.


0

Response Number 2
Name: Wolfbone
Date: April 26, 2004 at 15:06:16 Pacific
Reply:

Your egrep expressions are looking for the string "$PStr" because of the single quotes. Probably not what you wanted.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Help Unix Script

need help-unix script www.computing.net/answers/unix/need-helpunix-script/6516.html

help redoing unix script student db www.computing.net/answers/unix/help-redoing-unix-script-student-db/5151.html

HELP(short unix scripts) www.computing.net/answers/unix/helpshort-unix-scripts/4246.html