Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
you could maybe tell us what the command you're typing in actually is? we're not psychic.
and a terminal is NOT bah, they are very seperate things. think of a terminal emulator as a black rectangular box with a blinking cursor on it e.g. a car chassis. and bash as the code that actually listens to what you're typing e.g. a car engine. you can run may many different things instead of bash within a terminal, csh, ksh, ash, sh, or somethign that isn't even a shell at all.
ok, what terminal are you using?
You can also type everything in a terminal, or create a shell script.
To set a variable, you do
variablename="the text of your choice"
And to display it:
echo $variablename
If you want to make a shell script, you have to create a file let's call it filename.sh, which would contain, for example, something like this:
Then, in a normal terminal, make that file executable with
chmod 0755 filename.sh
and run it (in a terminal) with
./filename.sh
It should display "hello world"
Thanks for your help. I think i'm beginning to understand now! i'm a complete newbie so its hard getting your head round shell scripting- terminals etc but i've sorted out that minor problem and i'll be delving into it over the next few weeks - its looks interesting lol
If you do shell scripting, setting an environment variable does not work. As soon as you leave the script, you are back in the parent's environment, and all the variables in the child process (that is what you started your script in) are gone.
Is that your problem?
Did you read the document which is pointed to in my signature?
If you do shell scripting, setting an environment variable does not work. As soon as you leave the script, you are back in the parent's environment, and all the variables in the child process (that is what you started your script in) are gone.
Is that your problem?
Did you read the document which is pointed to in my signature?
jlinkels
NO i hadnt even got as far as that then ! i was just trying the commands in the tutorial and wasn't sure that using terminal was the right place to do it. I found out that i was just being stupid and typing the $ first which the tutorial showed but didn't explain you shouldn't type it.
Just shows that when giving advice you need to make it Absolutely clear what you mean!! it's too easy to forget that you take a lot of 'obvious' things for granted!
Yes i did go to your link thanks! its a great site and have been using that to write a little script.
Can I ask you about chmod?
chmod 0755 myfile.sh alters the mode of the file to an executable right? ok i did that and it all worked but i like to know what is going on - did it compile a binary when i did that? do you know how that works?
chmod 0755 simply changes permissions to make it executable. It gives it the permissions rwxr-xr-x.
Nothing is required to be compiled. When you run a script, bash takes it line by line and runs the appropriate programs. (or something like this)
To understand chmod, try "man chmod". You could also have typed in, for example, "chmod a+x myfile.sh", which means make the file executable (x) to everybody (a).
Check here if you want to learn more http://rute.2038bug.com/node17.html....00000000000000
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.