tr | letters to symbol, bash scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting tr | letters to symbol, bash scripting
# 1  
Old 05-22-2009
tr | letters to symbol, bash scripting

hi Im trying to make the 'response' return the answer in the form of a dash (-) rather than the actuall letters of a given word typed in, this is what i have tried, but im not getting the dashes come through just a blank screen, any ideas guys?


function enterWord () {
echo "select to be player 1 or 2"
read player

echo "player $player enter a word"
read response

clear
}

function readResponse () {
echo "$response | tr [a-zA-Z][_]"
}


enterWord
resp=$(readResponse)
echo "player $player your word was $resp"
# 2  
Old 05-22-2009
Code:
echo $response | tr '[a-zA-Z]' _

# 3  
Old 05-22-2009
works fine, thanks very much!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to print elements between letters bash script?

Hello to all, May somebody help me to fix my bash code below, I'd like to do it only using loops and if statements is possible. I the content of the arrays are represented by the following 2 strings, where each character is an element inside the array. String for case 1:... (10 Replies)
Discussion started by: Ophiuchus
10 Replies

2. Shell Programming and Scripting

bash scripting

Hello everyone!!!! I am new to this forum ...I have a problem. And I thought that you are expert :) so you can help me with that... I have a text file with maaany lines. Every line begins with something like that: <http aksjfskcuhrf kushkfsnus> <http sxnfrksehfsd gsdg r> I don't know if every... (16 Replies)
Discussion started by: mary_elen
16 Replies

3. Shell Programming and Scripting

bash scripting help

have this code but when i run it i get this error ./pulse: line 2: and here is the code #!/bin/bash if ; then pulseaudio -k; fi what am i doing wrong thanks Adam (5 Replies)
Discussion started by: ab52
5 Replies

4. Solaris

/usr/lib/passwdutil.so.1: symbol __nsl_fgetspent_r: referenced symbol not found

deleteing post (0 Replies)
Discussion started by: dshakey
0 Replies

5. Homework & Coursework Questions

bash,scripting

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: i have to do this but i am confused, Create a file containing the bash functions which perform the... (1 Reply)
Discussion started by: CRAZYLITTLELOU
1 Replies

6. Shell Programming and Scripting

bash scripting help!!

Hi, can anyone help me with my scrip please. I wanted do following tasks: 1. List all the directory 2. A STDIN to ask user to enter a directory name from listed directories 3. command to check if the directory exists( or a command to validate if the user entered a valid directory name)... (3 Replies)
Discussion started by: eminjan
3 Replies

7. Shell Programming and Scripting

bash scripting help

hi all i'm trying to get a script working upon connection with pppd According to docu this happens ina clean environment with a couple of variables set, namely $1,$2,... To be able to execute the statements i included a path statement but i think i'm running into trouble with the variables -... (6 Replies)
Discussion started by: jimjones
6 Replies

8. UNIX for Dummies Questions & Answers

Should I do a bash scripting course?!

Hello, I'm confused (oh, yes). I'm running Linux at work. When I type 'echo $SHELL' I am told that I'm running tcsh. In /bin I note that both tcsh and bash are listed. Question 1: Can I swap to run bash rather than tcsh and, if so, how will this affect my system? Is there any advantage to... (6 Replies)
Discussion started by: macpete
6 Replies

9. Shell Programming and Scripting

Bash Scripting

Hello there peeps: There is a little piece of bash shell scripting problem i have, which i was hoping you could help me with. #!/bin/bash stored_word() { case $(( $$ % 8 )) in 0 ) echo "energy";; 1 ) echo "touch";; 2 ) echo "climbing";; 3 ) echo... (3 Replies)
Discussion started by: keyvan
3 Replies
Login or Register to Ask a Question