Computing.Net > Forums > Unix > hola!!!!!!

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.

hola!!!!!!

Reply to Message Icon

Name: Gloria
Date: September 19, 2002 at 18:25:17 Pacific
OS: win XP
CPU/Ram: pentium 3
Comment:

HI, does some one know what does:
print "+---$dir" `ls -l $dir |sed 's/^.*'$dir' //'`
mean?



Sponsored Link
Ads by Google

Response Number 1
Name: jimbo
Date: September 19, 2002 at 20:31:29 Pacific
Reply:

Well the command does not run like that on my system. It had to change it to:

print "+---$dir" `ls -l $dir |sed 's/^.*"$dir" //'`

I don't know what it is supposed to do though, since "ls -l" does not show the hidden files anyway that sed 's/^.* is trying to remove. That's my take on it. It does run, but the output does not look like anything i'd want to use.

-jim



0

Response Number 2
Name: Jerry Lemieux
Date: September 22, 2002 at 22:43:26 Pacific
Reply:

If you post the rest of the script, you will see that it is part of some code that first performs a test to determine if a directory is a link. It is part of a script that prints a directory tree. If the test is true, the sed will get rid of everything but the directory name. Thus, in this particular script, if there is a directory named junk in the /tmp directory that is a link to /home/jlemieux, only the name jlemieux will be printed. It causes the output to look like this:

Initial directory = /tmp
+---bos
| +---oldvgs
+---junk -> /home/jlemieux
+---vgdata
| +---rootvg
Total directories = 4

Remove the sed and the output looks like this:

Initial directory = /tmp
+---bos
| +---oldvgs
+---junk lrwxrwxrwx 1 root user 14 Sep 23 01:20 junk -> /home/jlemieux
+---vgdata
| +---rootvg
Total directories = 4

Not what is wanted in this case.

Jerry Lemieux


0

Sponsored Link
Ads by Google
Reply to Message Icon






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: hola!!!!!!

Remove Lines based on a file www.computing.net/answers/unix/remove-lines-based-on-a-file/7419.html

XWindows (Linux) and Stealth 64 VRAM www.computing.net/answers/unix/xwindows-linux-and-stealth-64-vram/230.html

No problem. A challenge really. www.computing.net/answers/unix/no-problem-a-challenge-really/4989.html