![]() |
How to put custom text on Terminal (bash script) ?
This code:
Code:
#! /bin/bash P.S. I want to show my parents what happens when I do: Code:
sudo make\ me\ a\ sandwich (MrCode's profile sig) :) |
Well, I just read "man printf" and tried it.
Code:
#! /bin/bash |
More info needed!
What do you mean by failed? Are you getting any error message? How are you trying to run it? Did you make the file executable? Code:
chmod +x myscript |
Quote:
Code:
$ sudo make\ me\ a\ sandwich Code:
#! /bin/bash Then i made it executable: Code:
chmod u+x /home/user/make\ me\ a\ sandwich Code:
sudo make\ me\ a\ sandwich I also tried the "printf" instead of "echo" and it did not work. This is what happens: Code:
user@box~$ sudo make\ me\ a\ sandwich Thanks and sorry, man pages didn't help much |
Try breaking this down into its component parts.
Examples: - What happens if you don't use sudo? - What happens if you use a file name with no spaces in it? You should be able to work this out. Evo2. |
nevermind, I had to define the full file path, even though I was in the directory where the file is...
Code:
user@box:~$ ~/make\ me\ a\ sandwich How can I make it so all I have to type is: Code:
make me a sandwich |
I noticed this about your script:
Code:
#! /bin/bash The ./ (dot slash) tells bash "in this directory". You need it if the directory in question is not in your PATH environment variable. If you add your home directory to your PATH, you won't need the ./ Then, because of the spaces in the file name, just add quotes around the file name: "make me a sandwich" PATH=$PATH: /home/<username>, where <username> is your user name. |
Quote:
Evo2. |
Can't believe I did this...
Code:
.SILENT: Then Code:
make me_a_sandwich |
If you're old enough to be writing bash scripts, you're old enough to make your own sandwiches. :)
|
Hi,
Unless you include 'Please'. :hattip: |
everything works. very nice!
Lets see Windows make me a sandwich! |
All times are GMT -5. The time now is 10:42 PM. |