How do you assign the value of a parameter to a variable in UNIX?

Posted by codeninja on Stack Overflow See other posts from Stack Overflow or by codeninja
Published on 2010-04-24T15:59:59Z Indexed on 2010/04/24 16:03 UTC
Read the original article Hit count: 287

Filed under:
|
|
|
#!/bin/bash
if [ ! $1 ]
then
 echo "no param"
else
    set FAV_COLOR=$1
    echo "My fav color is ${FAV_COLOR}"
fi

This is not working how i expected:

>favcol.sh blue
My fav color is FAV_COLOR=blue

any thoughts?

© Stack Overflow or respective owner

Related posts about unix

Related posts about variables