bash notes
Snippet
Yeah, kitt finished writing this at 14:01 on 7 June 2015
Notes on bash
# length of a variable size=${#myvar} # confirming the length $ echo $size # => 11 # use in an if statement if [ ${#size} < 4 ]; then echo "mystr can't be fewer than 4 characters" exit fi barf=1 if [[ $barf ]] then; ... fi if [[ ! $id ]]; then echo "doesn't exist" else echo "exists. $id" fi
Add new comment