LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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, 12:57 PM   #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, 12:59 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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, 04: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, 11: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, 11:48 AM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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


All times are GMT -5. The time now is 06:30 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration