0

I am attempting to write a BASH script to return the following information from CPUINFO using the following commands

  • ./systemstat.sh -r to return the time along with total number of eth0 packets.
  • ./systemstat -c to return the vendor_id= and cpu MHz=.

When I use those commands, I recieve -bash: ./systemstat.sh: No such file or directory.

2

This is because you don't have systemstat.sh in your current directory .. The dot means the "current directory" or "working directory". If you do ls . you will notice that the script isn't there. For running this script you should either use:

  • the full path /path/to/script/systemstat.sh
  • copying them to a bin directory cp systemstat.sh /usr/local/bin/ then run without the dot: systemstat.sh
  • Or adding the directory where the script is to the path PATH=/path/to/script:$PATH and then execute the script without the dot.
  • or move your working directory to were the script is cd /path/to/script && ./systemstat.sh

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.