[clue] Bash baffler
foo7775 at comcast.net
foo7775 at comcast.net
Wed Jun 4 16:53:54 MDT 2014
Hi guys,
I'm trying to write a script to find setuid/setgid files on different servers, & while I think I'm pretty *close* to having it complete, I'm running into one error that I just can't seem to wrap my brain around. To begin with, here's the script (so far):
#!/bin/bash
set -x
for i in $(`df -hl | awk '{print $NF}' | grep -v ^\/dev`);
do
# find $i -path /proc -prune -o -type f -perm +6000 -ls >> /tmp/Test1_"$HOSTNAME".txt
echo $i| rev ;
done
I'll skip explaining the 1st two lines, since those are (probably) fairly obvious. The third line basically grabs a listing of *local* filesystems (so that I don't waste 'time x # of servers' rescanning common shared mounts) and assigns it (one line/filesystem at a time) to a variable.
The variable is then used as the target filesystem within a find statement (the intent is to keep from having to manually determine the local filesystems on each of the different servers) . In the script above, that line is commented out because I was trying to determine whether that line was contributing to the problem I'm seeing. The following 'echo' line is just there to provide output to the screen so that I can see what, if anything is being generated. (So far, that line isn't producing anything.)
Prior to adding the 'set -x' line for debugging, the only output that I received was the line ' forloop.sh: line 7: on: command not found '. It *seems* apparent that it's somehow extracting the center two characters from the 'done' string in line 7, & trying to use that as a command - but I have no idea how/why it's doing that.
After adding the 'set -x' line to the script, the output becomes:
+++ df -hl
+++ awk '{print $NF}'
+++ grep -v '^/dev'
++ on / /boot /home /opt /var /prod/app/local /prod/app/shared
forloop.sh: line 7: on: command not found
Is anyone here able to explain why I'm seeing this behavior?? Thanks in advance.
T.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20140604/f9079cd5/attachment.html
More information about the clue
mailing list