LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-13-2010, 11:57 AM   #1
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Rep: Reputation: Disabled
Question What does symbol ^ do in bash?


Hi.
What does symbol ^ do in bash?

For example:
Code:
grep -c ^processor /proc/cpuinfo
 
Old 09-13-2010, 11:59 AM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
In regular expressions, the carat symbol means "at beginning of line"; so, in order for a match to happen with your given example above, the word "processor" must be found at the beginning of a line.
 
1 members found this post helpful.
Old 09-13-2010, 03:58 PM   #3
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
That's what it does in the example you cite (with grep rather than as anything specific to bash) but it's an overloaded symbol - it can also negate matches in [...] expressions or exponentiate (bc) and several other things in other contexts. Just saying that, if you see ^ in a shell script, you have to know the various contexts.
 
1 members found this post helpful.
Old 09-14-2010, 10:17 AM   #4
Mr. Alex
Senior Member
 
Registered: May 2010
Distribution: No more Linux. Done with it.
Posts: 1,238

Original Poster
Rep: Reputation: Disabled
So it is called "carat symbol", right?
 
Old 09-14-2010, 10:48 AM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Caret is what I most often see it referred to as, and I cannot think of another name for it, although there are probably some. Here's the wiki page: http://en.wikipedia.org/wiki/Caret

Note that I had been spelling it incorrectly, but have now corrected it: Carat --> Caret
 
  


Reply



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
symbol lookup error: /usr/lib/libavcodec.so.51: undefined symbol: av_crc04C11DB7 priceey Linux - Software 0 05-06-2009 08:14 AM
./firefox-bin :symbol lookup error:/lib/libgthread-2.0.so.0: undefined symbol: arulupsaras Linux - General 1 11-08-2008 04:48 AM
symbol lookup error: /usr/lib/libgtk-x11.2.0.so.0: undefined symbol:... IamI Slackware 17 02-29-2008 11:10 AM
Workaround: 'symbol lookup error: k3b: undefined symbol: lstat64' devdol Linux - Software 2 02-15-2008 03:36 AM
./firefox-bin: symbol lookup error: /usr/lib/libpango-1.0.so.0: undefined symbol: g_s cb8100 Slackware 3 10-05-2006 10:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:39 PM.

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