Scripting help needed
For getting individual entries from $PATH variable i m using following scrip let.
Code:
#!/bin/bash |
Yes. You can either do anything from awk or use pure bash. The latter will look like this:
Code:
#!/bin/bash |
Hello colucix :)
As a variation on the same (at the expense of using a subshell, avoids need to save and restore IFS): Code:
( export IFS=':'; for dir in $PATH; do ls -ld $dir; done ) It could more simply be: Code:
( IFS=':'; for dir in $PATH; do ls -ld $dir; done ) |
Hello catkin! :)
That's a nice idea (I always hated this OLD_IFS stuff)! Something to take in mind as future reference. |
How about we just make it easy and leave IFS alone :)
Code:
for dir in ${PATH//:/ }; do ls -ld $dir; done |
Hi grail! :) That's right! Another nice solution.
|
Actually, I assume something else must be going to be done in the loop as the substituion could just be used with the ls on its own:
Code:
ls -ld ${PATH//:/ } |
Quote:
|
All times are GMT -5. The time now is 06:05 AM. |