LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Mandriva (http://www.linuxquestions.org/questions/mandriva-30/)
-   -   what is< g==> command ? (http://www.linuxquestions.org/questions/mandriva-30/what-is-g%3D%3D-command-789052/)

irajjs 02-14-2010 11:23 AM

what is< g==> command ?
 
Hello

I wanted to type: g++ , but i forgot to press shift key while typing ++ so, == was typed instead,then i pressed enter without knowing about my mistake.Then i saw g== entered, but i do not know what it is ,or what it does.
I do not know also how to undo commands (if possible),i just read somewhere that pressing arrow up acts as history of commands,and commands could be edited this way,so i did that,but still g== was on history.

Thank you

acid_kewpie 02-14-2010 12:11 PM

that just sets the variable "g" to be an equals sign.

And there is no "undo" for a command line.

catkin 02-14-2010 12:12 PM

Don't worry; all you did was to set shell variable $g to =
Code:

c@CW8:~$ g==
c@CW8:~$ echo $g
=

EDIT: acid_kewpie beat me to it :)

vrmartin2 02-15-2010 05:14 AM

Actually there is an undo:

unset g

mannoj 02-15-2010 06:19 AM

It is not necessary to think much more about pressing some unwanted keys unintentionally.

It's true, that you could search history using up arrow and down arrow.

irajjs 02-15-2010 10:53 AM

Development tools should be clean.
 
Quote:

Originally Posted by catkin (Post 3863483)
Don't worry; all you did was to set shell variable $g to =
Code:

c@CW8:~$ g==
c@CW8:~$ echo $g
=

EDIT: acid_kewpie beat me to it :)

Hi

I am not worried any more,but since g++,c++.seem to be development tools,and i have started to use them ,so i want to keep them clean and with no mistakes.

Thank you.

acid_kewpie 02-15-2010 12:40 PM

Your intentions seem honourable, but it doesn't really make sense in this context, so don't worry about it, you're in no danger of damaging anything.

irajjs 02-16-2010 05:00 AM

shell variables
 
Quote:

Originally Posted by acid_kewpie (Post 3864638)
Your intentions seem honourable, but it doesn't really make sense in this context, so don't worry about it, you're in no danger of damaging anything.

Hi

I do not know about shell variables and what they can do,but my supposition is that whenever i press and enter = on terminal,then probably it will act ,since i do not know what would be the action,i am concerned about that. Of course i am going to learn about shell variables by studying ....
Thank you.

vrmartin2 02-17-2010 06:06 AM

Every time you enter something at the command line of a shell, it will assume that the first thing on the command line is a command. It begins by parsing the command using characters defined in an environment variable called $IFS (internal field separator). But you can safely assume that means "white space" (See http://www.livefirelabs.com/unix_tip...3/10132003.htm). So the shell splits up the command into "words" which are collections of characters it has parsed out using white space for the delimiter. It then assumes that the first word is a command and checks to see if it is a command build into the shell itself. If not, it attempts to find the command (looking in paths defined in the $PATH environment variable), and if found it runs the command, handing the command all remaining words that were on your command line.

If you want, try typing "=" and hitting enter. See what happens. It should tell you that the "=" command was not found. If you don't get some message like that, then the shell did find some command to run or it handled the command itself. So, when you typed "g==" and hit enter, it did not look for a command to run, because from its perspective, this was a valid shell command, setting a variable to the value =.

Understanding this much should get you a bit farther along and should dispel some of your concerns.

ALSO: you can use the "which" and "whereis" commands to find out where the shell is finding a command or if it will find it at all:

whereis <some command>: tells you all the different places it could look (defined in $PATH) to find a command.
which <some command>: tells you exactly which of the possibilities it is really going to run for you

Example:

admvrm@vrmartinplmdevv6suse:~> which gcc
/usr/bin/gcc
admvrm@vrmartinplmdevv6suse:~>


admvrm@vrmartinplmdevv6suse:~> whereis echo
echo: /bin/echo /usr/share/man/man1p/echo.1p.gz /usr/share/man/man3/echo.3ncurses.gz /usr/share/man/man1/echo.1.gz
admvrm@vrmartinplmdevv6suse:~>

irajjs 02-18-2010 07:07 AM

Studying about shell commands
 
Quote:

Originally Posted by vrmartin2 (Post 3866717)
Every time you enter something at the command line of a shell, it will assume that the first thing on the command line is a command. It begins by parsing the command using characters defined in an environment variable called $IFS (internal field separator). But you can safely assume that means "white space" (See http://www.livefirelabs.com/unix_tip...3/10132003.htm). So the shell splits up the command into "words" which are collections of characters it has parsed out using white space for the delimiter. It then assumes that the first word is a command and checks to see if it is a command build into the shell itself. If not, it attempts to find the command (looking in paths defined in the $PATH environment variable), and if found it runs the command, handing the command all remaining words that were on your command line.

If you want, try typing "=" and hitting enter. See what happens. It should tell you that the "=" command was not found. If you don't get some message like that, then the shell did find some command to run or it handled the command itself. So, when you typed "g==" and hit enter, it did not look for a command to run, because from its perspective, this was a valid shell command, setting a variable to the value =.

Understanding this much should get you a bit farther along and should dispel some of your concerns.

ALSO: you can use the "which" and "whereis" commands to find out where the shell is finding a command or if it will find it at all:

whereis <some command>: tells you all the different places it could look (defined in $PATH) to find a command.
which <some command>: tells you exactly which of the possibilities it is really going to run for you

Example:

admvrm@vrmartinplmdevv6suse:~> which gcc
/usr/bin/gcc
admvrm@vrmartinplmdevv6suse:~>


admvrm@vrmartinplmdevv6suse:~> whereis echo
echo: /bin/echo /usr/share/man/man1p/echo.1p.gz /usr/share/man/man3/echo.3ncurses.gz /usr/share/man/man1/echo.1.gz
admvrm@vrmartinplmdevv6suse:~>

Thank you

I am studying about shell commands...etc,but it seems still a long way to understand and learn enough.
Yesterday i tried to undo or reverse the command g== by typing
unset g== but, output showed no success.(probably it was : no such file or...),so if i have set shell variable to = (as friend katkin said before),then why wasn,t that unset later?

My understanding which caused posting LQ ,is that some times a small change can cause a great deviation in the long run,so one should know what he/she is doing,specially in cases which are valued more,and to me g++, c++ are more important because of their capabilities.

catkin 02-18-2010 11:55 PM

Quote:

Originally Posted by irajjs (Post 3868034)
esterday i tried to undo or reverse the command g== by typing
unset g== but, output showed no success

unset g


All times are GMT -5. The time now is 09:45 PM.