To append \ in the input password


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers To append \ in the input password
# 1  
Old 04-28-2009
To append \ in the input password

Hi
I have the following issue
i am going to ask from the user the password
The password can have $ anywhere that is first last or in between but i have to append \ before the $ sign in the password can anyone please help

For example
o/p in the console will be like the following

Please Enter the password
Su$esh

Internally i should make it Su\$esh
How to achieve this. Can anyone please help

Thanks in advance
Suresh
# 2  
Old 04-29-2009
Guessing you are using a shell-script, you can use for example:

Code:
echo 'aa$bb'| sed 's/\$/\\\$/g'
aa\$bb


Last edited by zaxxon; 04-29-2009 at 06:29 AM.. Reason: added the g
# 3  
Old 04-30-2009
Thank you for the help
# 4  
Old 04-30-2009
zaxxon -- how exactly will he get a variable password inside those single quotes? Smilie

Good thing you don't need them.

Code:
password='aaa$bbb'
echo $password
echo $password | sed -e 's/\$/\\$/g'

 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help OS X script : password input

Hello Sorry for the question.. i would like to make a script for OS X that allow me to change the password for a user account. i have to use this script on several iMac with the same user/password. i want to store the passwords inside the script, no security problems involved. the... (9 Replies)
Discussion started by: araan87
9 Replies

2. Shell Programming and Scripting

<< generate alphabets and append in the input values >>

Hi Team, Pls help to get the desired output. I have a input like below nodecount=10 host=na7-db1-1-chi nodecount can be 10 or 8 based on this we need a output (in single line) like below na7-db1-1-chi:A na7-db1-2-chi:B na7-db1-3-chi:C na7-db1-4-chi:D na7-db1-5-chi:E... (4 Replies)
Discussion started by: kamauv234
4 Replies

3. Shell Programming and Scripting

sed to append on specific line in password file

I have the a group file and my ftp group line looks like this ... (3 Replies)
Discussion started by: slufoot80
3 Replies

4. UNIX for Advanced & Expert Users

Append password on script when restarting web instance

im writing a start/stop script for a web instance (solaris) . Currently I usually start it using the command below and it will ask me to put the token password for the web_instance. (token pw: 12345) /opt/SUNWwbsvr/https-www.myhost.com/start I would like to create a script that... (4 Replies)
Discussion started by: lhareigh890
4 Replies

5. Shell Programming and Scripting

Append file based upon user input-- solved

Ok, I have a script with a commandline option that allows the user to add a custom function to the script file. I have tried everything in my limited knowledge of sed to get this to work and keep coming up short. I need sed to search for a line starting with a pattern, I've got that part so far,... (0 Replies)
Discussion started by: DC Slick
0 Replies

6. Shell Programming and Scripting

input username and password interactively

Hi guys, I am using Solaris 10 and we install IBM OnDemand server there. there's a command called arsload that we use to load document and query document too. I need to write a script to query document but when querying document, this command prompt for username then password. My question is... (3 Replies)
Discussion started by: markthien
3 Replies

7. Shell Programming and Scripting

Input Password

I am writing a script that can automatically login to Storage CAM console. i use this command, ./sscs login -u user -h localhost. at that time it will prompt for password, is it possible for store password in a file and supply it when it waits for password. Thanks in advance. Regards SK (1 Reply)
Discussion started by: cutechaps
1 Replies

8. Shell Programming and Scripting

Take user input and then append to another file

Hi, I have below line from the config file $__MR_CONFIG = 'userinput'; I want to get the value from the user for the "userinput" and then append the full line to another file. Can you please let me know how can I proceed on this? I am new to unix and your help is greatly appreciated.... (3 Replies)
Discussion started by: nav123
3 Replies

9. Shell Programming and Scripting

Input Password

I have a script which connects to database. I want user to input user name and password but dont want the password characters to be displayed on screen. How can i accept input from user in encrypted form. (2 Replies)
Discussion started by: baglasumit21
2 Replies

10. Shell Programming and Scripting

I want to append password in /etc/shadow file

Hi, I want to append password into /etc/shadow file using a shell script. My below script does add the users to both /etc/passwd and /etc/shadow but how can I add the hordcoded passwords to /etc/shadow file can some one help me ? # To add the groups into /etc/group file for a_user... (5 Replies)
Discussion started by: modgil
5 Replies
Login or Register to Ask a Question