15 January 2014

Notes on using the shell

Since I mostly use the shell under embedded linux, when I say /bin/sh I really mean /bin/ash, the Almquist shell, which is compiled into BusyBox and therefore pretty cheap resource-wise.

Maybe there are some people out there who like shell syntax. Suffice it to say I am not one of them. 

Syntax


Some helpful links for myself:
The secret to successful shell Googling is knowing that "[" is pronounced "test".

Code Chunks

I can't believe I have to actually write down how to make a for loop.

POSIX-compatible For Loop

#/bin/sh
i=0
max=60
while [ $i -lt $max ]; do
  echo "$i"
  true $(( i++ ))
done

Assuming I can edit blogger posts, I'll edit this later.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.