Hi guys,
I have a script which I would like to run as a shell pipeline, so I copied it all into one line and it does not work.
su - root -c "echo /:${PATH}" | tr ':' '\n' | while read DIR ; do ; DIR=${DIR:-$(pwd)} ; print "Checking ${DIR}"; while [[ -d ${DIR} ]]; do; [[ "$(ls -ld ${DIR})" = @(d???????w? *) ]] && print " WARNING ${DIR} is world writable" || print " ${DIR} is not world writable"; [[ "$(ls -ld ${DIR})" = @(d????w???? *) ]] && print " WARNING ${DIR} is group writable" || print " ${DIR} is not group writable" ; [[ "$(ls -ld ${DIR} |awk '{print $3}')" != @(root|bin) ]] && print " WARNING ${DIR} is not owned by root or bin"; DIR=${DIR%/*}; done; done
I just get - ksh: 0403-057 Syntax error: `;' is not expected.
Is what I am trying possible?
Thank you
I have a script which I would like to run as a shell pipeline, so I copied it all into one line and it does not work.
su - root -c "echo /:${PATH}" | tr ':' '\n' | while read DIR ; do ; DIR=${DIR:-$(pwd)} ; print "Checking ${DIR}"; while [[ -d ${DIR} ]]; do; [[ "$(ls -ld ${DIR})" = @(d???????w? *) ]] && print " WARNING ${DIR} is world writable" || print " ${DIR} is not world writable"; [[ "$(ls -ld ${DIR})" = @(d????w???? *) ]] && print " WARNING ${DIR} is group writable" || print " ${DIR} is not group writable" ; [[ "$(ls -ld ${DIR} |awk '{print $3}')" != @(root|bin) ]] && print " WARNING ${DIR} is not owned by root or bin"; DIR=${DIR%/*}; done; done
I just get - ksh: 0403-057 Syntax error: `;' is not expected.
Is what I am trying possible?
Thank you