Results 1 to 4 of 4
Pathetically simple question for you folks, but I'm still learning.
After you read it and have a giggle, what is the correct verdict?
For an internal linux command to execute ...
- 04-20-2008 #1
Correct command execution syntax.
Pathetically simple question for you folks, but I'm still learning.
After you read it and have a giggle, what is the correct verdict?
For an internal linux command to execute inside a script do we just enter the command on it's own:
# this is the script
clear
date
__________________________________________
Or is it more like this:
# this is the script
clear
echo $date
I don't have a working linux at home so I can't find out for myself.
And google produced everything except what I wanted to know.
- 04-20-2008 #2
The first script works fine for me and the second does not display anything.
- 04-20-2008 #3Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
It depends on what you intend to do. Both scripts are correct if you look at the syntax (if you except the lack of the shabang on the first line).
The first one, issues the command "clear", and then the command "date".
The second one issues the command "clear", and then it echoes the contents of the variable called "date", which might be empty (so it will not output anything at all).
- 04-20-2008 #4
Indeed. Here's the cool thing:
A Bash script is simply a series of commands that Bash understands. Any script could be entered on the commandline, and Bash would understand it perfectly.
In the commandline, how do you run the command "date"? You type "date". How do you print out the value of the variable $date? "echo $date".
And so on, so forth.DISTRO=Arch
Registered Linux User #388732


Reply With Quote
