Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I wrote a simple script for TuxNes emulator (Nintendo emulator).
The script works with loading files with names where there is no spaces in between the characters.
for example (Because i dont have access to my computer my script is much longer and doesnt look exactly like this)
!#Bin Bash
echo Which game would you like to play?
Read X;
if [-n, x]
tuxnes --video=1024x768 -- <some other options> $X;
else
echo No such game.
when I enter a game like Superman the game properly loads from the script. However when i enter a game like Super Mario Bros i get either file not found or
when I get the prompt which Game you would like to play?
sometimes I enter Super/ Mario/ Bros/ 3* and i get an error too many arguments.???
Does anyone know how to make the bash read command accept spaces that are in what you input????
Does anyone know which bash command will accept input with spaces between characters?
Is there a way to make the Read command accept spaces such as in file names like
Super Mario Bros (U).nes
Last edited by Kilahchris; 11-05-2004 at 08:39 PM.
I don't belive that was where he was talking about using the quotes, try it when you input the name:
$> ./tuxnes.sh
Which game would you like to play?
"Super Mario Brothers"
If that doesn't work you may have to insert surrounding quotes or escape the spaces inside the variable X. My guess is that if X is "super mario" then the command:
tuxnes $X
would try to run on both words like two seperate options, as if you typed:
tuxnes super
tuxnes mario
If you could do something like $X = quotes + $X + quotes then the command would work although I can't for the life of me think of the right syntax that would add the quote symbol into the beginning and end of a variable.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.