* Script problem
@ 2005-05-13 16:15 Glonn
2005-05-14 8:56 ` banzai
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Glonn @ 2005-05-13 16:15 UTC (permalink / raw)
I am trying to create a user account adding script using 'useradd'
the problem is I cannot seem to enter the persons name with a space in
the text field i.e. -c 'Jack Burton' see script below
echo "Enter Username"
read user1
echo "Type Home Directory"
echo "i.e. /home/IOP"
read home1
echo "Type First Name Surname"
read name1
/usr/sbin/dop useradd_script -g 201 -d $home1 -c $name1 $user1
exit
The script above replies with a syntax error because $name1 has a
space in it how do I enter it with the ' ' enclosing the string
Thanks in advance
Glonn
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Script problem
2005-05-13 16:15 Script problem Glonn
@ 2005-05-14 8:56 ` banzai
2005-05-14 13:22 ` vishal
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: banzai @ 2005-05-14 8:56 UTC (permalink / raw)
Haven't tested, but from the top of my head you coud add a second parameter
to read
i.e.
read name1 name2
and then
/usr/sbin/dop useradd_script -g 201 -d $home1 -c $name1 $name2 $user1
"Glonn" <glenn.morris@hinchingbrooke.nhs-dot-uk.no-spam.invalid> wrote in
message news:d62jq7$96j$2@domitilla.aioe.org...
> I am trying to create a user account adding script using 'useradd'
> the problem is I cannot seem to enter the persons name with a space in
> the text field i.e. -c 'Jack Burton' see script below
>
> echo "Enter Username"
> read user1
> echo "Type Home Directory"
> echo "i.e. /home/IOP"
> read home1
> echo "Type First Name Surname"
> read name1
>
> /usr/sbin/dop useradd_script -g 201 -d $home1 -c $name1 $user1
>
> exit
>
> The script above replies with a syntax error because $name1 has a
> space in it how do I enter it with the ' ' enclosing the string
>
> Thanks in advance
>
> Glonn
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Script problem
2005-05-13 16:15 Script problem Glonn
2005-05-14 8:56 ` banzai
@ 2005-05-14 13:22 ` vishal
2005-05-14 18:21 ` Stuart Fuller
2005-05-18 9:50 ` problem Glonn
3 siblings, 0 replies; 5+ messages in thread
From: vishal @ 2005-05-14 13:22 UTC (permalink / raw)
have you tried escaping it?
/usr/sbin/dop useradd_script -g 201 -d $home1 -c \'$name1\' $user1
or
/usr/sbin/dop useradd_script -g 201 -d $home1 -c \"$name1\" $user1
vishal
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Script problem
2005-05-13 16:15 Script problem Glonn
2005-05-14 8:56 ` banzai
2005-05-14 13:22 ` vishal
@ 2005-05-14 18:21 ` Stuart Fuller
2005-05-18 9:50 ` problem Glonn
3 siblings, 0 replies; 5+ messages in thread
From: Stuart Fuller @ 2005-05-14 18:21 UTC (permalink / raw)
Glonn wrote:
> I am trying to create a user account adding script using 'useradd'
> the problem is I cannot seem to enter the persons name with a space in
> the text field i.e. -c 'Jack Burton' see script below
>
> echo "Enter Username"
> read user1
> echo "Type Home Directory"
> echo "i.e. /home/IOP"
> read home1
> echo "Type First Name Surname"
> read name1
>
> /usr/sbin/dop useradd_script -g 201 -d $home1 -c $name1 $user1
>
> exit
>
> The script above replies with a syntax error because $name1 has a
> space in it how do I enter it with the ' ' enclosing the string
>
> Thanks in advance
>
> Glonn
/usr/sbin/dop useradd_script -g 201 -d $home1 -c "$name1" $user1
--
Stu
^ permalink raw reply [flat|nested] 5+ messages in thread* re:Script problem
2005-05-13 16:15 Script problem Glonn
` (2 preceding siblings ...)
2005-05-14 18:21 ` Stuart Fuller
@ 2005-05-18 9:50 ` Glonn
3 siblings, 0 replies; 5+ messages in thread
From: Glonn @ 2005-05-18 9:50 UTC (permalink / raw)
Thanks to all who replied - I tried all the solutions but the one that
worked was Stu
Thanks again
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-18 9:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 16:15 Script problem Glonn
2005-05-14 8:56 ` banzai
2005-05-14 13:22 ` vishal
2005-05-14 18:21 ` Stuart Fuller
2005-05-18 9:50 ` problem Glonn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox