Friday, 30 August 2013

User Input for Variables in Bash Script

User Input for Variables in Bash Script

I'm trying to create a script that simplifies the process of creating a
new user on an iOS device. Here are the steps broken down.
# fullname="USER INPUT"
# user="USER INPUT"
# group=$user
# uid=1000
# gid=1000
# home=/var/$user
# echo "$group:*:$gid:$user" >> /private/etc/group
# echo "$user::$uid:$gid::0:0:$fullname:$home:/bin/sh" >>
/private/etc/master.passwd
# passwd $user
# mkdir $home
# chown $user:$group $home
As you can see some fields require input. How can I request input for a
variable in script?

No comments:

Post a Comment