LinuxQuestions.org
Review your favorite Linux distribution.
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 07-18-2008, 10:11 AM   #1
JimRobinson
LQ Newbie
 
Registered: Jul 2008
Posts: 5
Blog Entries: 1

Rep: Reputation: 0
Using echo


I have worked with Unix for many years and have recently moved to a Linux shop...no big deal but I have a question.

Does an echo actually trigger a process to run? In my experience the answer would be no!!

echo "runprocess blabla blabla > blabla"

this would never run "runprocess", only echo to the screen or standard out right?
 
Old 07-18-2008, 10:21 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Right. echo will only display it, whereas eval will execute it.
 
Old 07-18-2008, 10:41 AM   #3
JimRobinson
LQ Newbie
 
Registered: Jul 2008
Posts: 5
Blog Entries: 1

Original Poster
Rep: Reputation: 0
My first bad code catch ha ha
 
Old 07-18-2008, 03:35 PM   #4
john test
Member
 
Registered: Jul 2008
Distribution: ubuntu 9.10
Posts: 527
Blog Entries: 1

Rep: Reputation: 35
echo Hostname: $(hostname)
echo -n "Hostname: "
--------------------------------------
Do the two examples above kick off a process?
Doesn't $(hostname) initiate a process?
Doesn't the -n in the second example initiate a process to suppress aewline?
 
Old 07-18-2008, 05:07 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by john test View Post
echo Hostname: $(hostname)
echo -n "Hostname: "
--------------------------------------
Do the two examples above kick off a process?
The first command forks a new process (hostname) due to command substitution.
Quote:
Doesn't $(hostname) initiate a process?
Aforementioned.
Quote:
Doesn't the -n in the second example initiate a process to suppress a newline?
No.
 
  


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
ls | echo, I got blank, why can't echo take the 2nd seat in a pipeline? elinuxqs Linux - Newbie 6 11-24-2006 09:25 AM
BASH: How to NOT echo to screen with "if echo $x | grep ".*"; then" eur0dad Programming 9 07-27-2006 03:14 PM
Kphone echo (echo echo) scabies Linux - Software 0 10-18-2004 03:59 PM
Echo /devPrinting doesn't work, echo /usb/lp0 works, Testpage works, Printing doesn't Hegemon Linux - General 3 08-15-2002 02:13 PM
Echo linux_freak Linux - General 1 06-05-2001 03:25 PM


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