Writing a script for ash?

Posted by rumtscho on Super User See other posts from Super User or by rumtscho
Published on 2010-03-25T15:28:08Z Indexed on 2010/03/25 15:33 UTC
Read the original article Hit count: 581

Filed under:
|

My VPN is behaving funny sometimes, and I have to restart it often. I wanted to write a script which does that for me. It doesn't have to be anything fancy, just a shortcut for the commands I have to type into the terminal. More specifically: it will look at the running processes. If it finds a running vpnc process, it will kill it. Then it will start vpnc.

I've written bash scripts of similar complexity, but now I don't have a bash, only an ash. Until now, the only difference I noticed is that there are much less commands available, but then, I don't use it very often. So I have some questions.

  1. Is writing ash scripts different than writing bash scripts?
  2. Is there something specific to consider when doing it?
  3. When the script is ready, how can I deploy it? For bash, I just put the executable file under /usr/lib and run it by typing the file name into the command line, will this work with ash?
  4. Are there any special pitfalls to watch out for in the script I want to write? I think that the killing process part may get hairy, if I write something that kills the wrong process, but even then running the script shouldn't break anything permanently, right?

© Super User or respective owner

Related posts about linux

Related posts about shell-scripting