Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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