LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-28-2008, 09:05 PM   #1
Kai'
LQ Newbie
 
Registered: Apr 2008
Distribution: Redhat; Fedora
Posts: 7

Rep: Reputation: 0
changing variables using user-input


hey, I ran into a problem when I was trying to make a script that edited the PS1 variable. and it doesn't work. here's the line(s):

echo "Type in the name for your prompt"
read $prompt

PS1="[Sprompt \W]"
echo "prompt changed"

where did this script fail or go wrong?

Last edited by Kai'; 04-28-2008 at 09:05 PM. Reason: incomplete
 
Old 04-28-2008, 09:25 PM   #2
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
The read doesn't need a $ at the variable name, and the PS1=... does need $prompt, not Sprompt.
 
Old 04-29-2008, 04:45 AM   #3
Kai'
LQ Newbie
 
Registered: Apr 2008
Distribution: Redhat; Fedora
Posts: 7

Original Poster
Rep: Reputation: 0
oh, that S was my own typo here, well, thanks.
 
Old 04-29-2008, 06:04 PM   #4
Kai'
LQ Newbie
 
Registered: Apr 2008
Distribution: Redhat; Fedora
Posts: 7

Original Poster
Rep: Reputation: 0
well, it seems as though the script still didn't run
what seems to happen is like the whole line is ignored
all together (the PS1="[$prompt \W]") the new change
did not work as well. Is there a way to fix this or
another method?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User input into Bash scripts and checking validity of user input?? helptonewbie Programming 8 07-07-2008 06:40 PM
Shell script question - Lynx + input variables viceroy Programming 2 07-22-2007 07:25 PM
changing environment variables. Geminias Linux - Newbie 2 01-04-2006 06:02 PM
changing variables from background job bobwall Programming 2 06-18-2005 02:28 PM
changing php info variables?? vickr1z Linux - Newbie 1 10-26-2004 10:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration