I made this simple script to test wat u said jimbo:
print -n "Enter file name: "
read name
ls -ld $name |
cut -c2-10 |
/usr/bin/tr [-rwx] [0421] |
sed "s/./&/g" |
awk '{print $1+$2+$3+$4+$5+$6+$7+$8+$9}'
Comes up with a error message:
/usr/bin/tr: Bad string.
Doesn't seem iv soloved the problem, but these worked:
echo "-777" | tr '\-rwx' 0421
echo "rwx" | /usr/bin/tr rwx 421
Just tried this:
ls -l menu | cut -c2-10 | tr '\-rwx' 0421
which produced this outcome:
421000000 (which is correct)
but, when i tried this:
ls -l menu | cut -c2-10 | tr '\-rwx' 0421 | sed "s/./& /g" | awk '{print $1+$2+$3 $4+$5+$6 $7+$8+$9}'
produces:
421000000 which is the same as the above, seems that its not converting.
So, the problem is between:
sed "s/./& /g" |
awk '{print $1+$2+$3 $4+$5+$6 $7+$8+$9}'
those lines of code
Can ne1 help??