LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 02-14-2010, 11:23 AM   #1
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204
Blog Entries: 1

Rep: Reputation: 15
Smile 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
 
Old 02-14-2010, 12:11 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
that just sets the variable "g" to be an equals sign.

And there is no "undo" for a command line.
 
1 members found this post helpful.
Old 02-14-2010, 12:12 PM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
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
 
1 members found this post helpful.
Old 02-15-2010, 05:14 AM   #4
vrmartin2
Member
 
Registered: Dec 2009
Location: NE Ohio
Distribution: Open SUSE
Posts: 43

Rep: Reputation: 19
Actually there is an undo:

unset g
 
Old 02-15-2010, 06:19 AM   #5
mannoj
LQ Newbie
 
Registered: Sep 2009
Location: India
Posts: 20

Rep: Reputation: 1
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.
 
Old 02-15-2010, 10:53 AM   #6
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Smile Development tools should be clean.

Quote:
Originally Posted by catkin View Post
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.
 
Old 02-15-2010, 12:40 PM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 02-16-2010, 05:00 AM   #8
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Smile shell variables

Quote:
Originally Posted by acid_kewpie View Post
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.
 
Old 02-17-2010, 06:06 AM   #9
vrmartin2
Member
 
Registered: Dec 2009
Location: NE Ohio
Distribution: Open SUSE
Posts: 43

Rep: Reputation: 19
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:~>
 
Old 02-18-2010, 07:07 AM   #10
irajjs
Member
 
Registered: Jan 2010
Location: Karaj , Iran
Distribution: Mandriva 2012
Posts: 204

Original Poster
Blog Entries: 1

Rep: Reputation: 15
Smile Studying about shell commands

Quote:
Originally Posted by vrmartin2 View Post
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.
 
Old 02-18-2010, 11:55 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by irajjs View Post
esterday i tried to undo or reverse the command g== by typing
unset g== but, output showed no success
unset g
 
  


Reply

Tags
command, ifs, shell



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to copy drive using dd and tee command parallely? source code of dd command mdfakkeer Linux - Software 1 02-10-2010 01:31 PM
Only execute 2nd command on successufl execution of 1st command kregec05 Linux - Newbie 3 08-19-2009 10:29 AM
[SOLVED] append command output to file by giving command in terminal sumeet inani Linux - Newbie 4 07-03-2009 10:36 AM
URGENT! Is there any command to get a history command lines and time in SUSE Linux.? igsoper Linux - Software 5 06-25-2009 02:14 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 04:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration