Ok, so here is what I am trying to do - I have a bunch of archives that are named:


once each is extracted, I want to iterate through all the files in that directory and run an exe against the data in the file.

tar -xzf newnslog.58.tar.gz
cd newnslog.59 < yes the filename in the archive may be 1 more or less or the same as it is a continuation
newnslog.ppe.0  newnslog.ppe.1  newnslog.ppe.2
#execute nsc2e with parameters against each file:
# ../nsc2e -c /netscaler/nsconmsg -K newnslog.ppe.0 -f ../nsc2e.conf

I am trying a for - do loop but I must be doing something wrong:

root@VPX-13# for f in *; do '../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf'; done
-bash: ../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf: No such file or directory
-bash: ../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf: No such file or directory
-bash: ../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf: No such file or directory

I also know there must be a streamlined way to do everything including the extraction - something like:

find newnslog* -prune -type d | while IFS= read -r d; do 
    cd "$d"
    for f in *; do '../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf'; done

1 Answer 1


Dropping the quotes around the command as per ilkkachu's comment:

for f in *; do ../nsc2e -c /netscaler/nsconmsg -K "$f" -f ../ns2ce.conf; done

... solved the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.