Welcome to WebmasterWorld Guest from 54.196.231.129

Forum Moderators: bakedjake

Message Too Old, No Replies

Linux shell scripting, simple but ...?

how to assign variable with a specific path

     
1:03 pm on Nov 6, 2004 (gmt 0)

New User

10+ Year Member

joined:Sept 25, 2004
posts:5
votes: 0


How to assign variable in shell scripting (i'm using vi in Mandrake) with a specific path based on user input?

For example :
The user input is /home/alex

and then i want to assign it to var link...

Thanks

1:23 pm on Nov 6, 2004 (gmt 0)

Full Member

10+ Year Member

joined:Dec 11, 2003
posts:241
votes: 0


I'd recommend reading the bash scripting guide, as it will answer you questions better than I can

[tldp.org...]

3:14 am on Nov 8, 2004 (gmt 0)

Preferred Member

10+ Year Member

joined:Nov 16, 2003
posts:522
votes: 0


or better: start learning perl
2:00 am on Nov 9, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:May 28, 2003
posts:62
votes: 0


I agree with the Perl comment, but we don't always decide the language we use.

$home for the users home path

$user for the user

Q

10:12 pm on Nov 9, 2004 (gmt 0)

Administrator

WebmasterWorld Administrator bakedjake is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Apr 8, 2003
posts:3783
votes: 2


perl

Overkill for many common tasks.

9:55 am on Nov 14, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 8, 2004
posts:63
votes: 0


not 100% sure if this is right..but maybe:

${VariableName} == "User input"
PATH=:/home/alex/$VariableName