Difference between system and echo


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Difference between system and echo
# 1  
Old 07-25-2011
Difference between system and echo

What is the difference between system and echo in calling the unix commands from perl? how else can the unix commands be called in perl?
# 2  
Old 07-25-2011
Quote:
echo in calling the unix commands from perl
???
# 3  
Old 07-25-2011
yes. Can you tell me how can unix commands be called inside perl?
# 4  
Old 07-25-2011
# 5  
Old 07-25-2011
Thanks Yazu
# 6  
Old 07-25-2011
you can use,
system() command for executes the system commands
you can use print command insted of `echo` for write expres/values
in perl.

I try to write a simple script maybe this will help you Smilie

Code:
!#/usr/bin/perl -w
print "what is your fav shell? ";
$shell = <STDIN>;
print "Execute a new $shell (y/n) ? ";
$choice = <STDIN>;
if ($choice eq "y\n")
{ print "Executing new shell\n"; system("$shell"); }
elsif ($choice eq "n\n")
{ print "Exiting\n"; }
 
$write="perl script completed!!";
system ("echo $write");
 
$echo = `echo $write`;
print $echo;


regards
ygemici
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Difference between echo `ls -l` and echo "`ls -l`" ?

Hi guys, Been messing around with shell programming for a couple of days and I found something that was pretty odd in the behavior of the echo command. Below is an example-: When I type the following in my /home directory from my lxterminal in Debian-: echo "`ls -l`" I get the... (2 Replies)
Discussion started by: sreyan32
2 Replies

2. Shell Programming and Scripting

tcsh - understanding difference between "echo string" and "echo string > /dev/stdout"

I came across and unexpected behavior with redirections in tcsh. I know, csh is not best for redirections, but I'd like to understand what is happening here. I have following script (called out_to_streams.csh): #!/bin/tcsh -f echo Redirected to STDOUT > /dev/stdout echo Redirected to... (2 Replies)
Discussion started by: marcink
2 Replies

3. Programming

Difference between system calls and normal functions in C

hello all, i'm a beginner in linux programming. I need to know what is the difference between system calls and normal functions like fopen, fread etc in C?Also how to set permissions by using open system call? (11 Replies)
Discussion started by: aarathy
11 Replies

4. UNIX for Dummies Questions & Answers

Difference between system uptime and last boot time.

My Linux system was last rebooted few hours ago. But it seems little confusing for me to figure out the exact reason behind it. I guess following command should justify what i meant to say. # date Wed May 11 13:22:49 IST 2011 # last | grep "May 10" reboot system boot 2.6.18-194.el5 ... (5 Replies)
Discussion started by: pinga123
5 Replies

5. UNIX for Dummies Questions & Answers

Difference between system console and ILOM .

HI Guru's Can any one explain me the difference between a system console and a ILOM (SC). Thanks in Advance. RK :) (4 Replies)
Discussion started by: rama krishna
4 Replies

6. Homework & Coursework Questions

What is the difference between a Host and an End System?

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I have a question about the difference between a host and an end system. I have read a textbook and I am still... (2 Replies)
Discussion started by: greenesses
2 Replies

7. UNIX for Dummies Questions & Answers

How to correctly use an echo inside an echo?

Bit of a weird one i suppose, i want to use an echo inside an echo... For example... i have a script that i want to use to take users input and create another script. Inside this script it creates it also needs to use echos... echo "echo "hello"" >$file echo "echo "goodbye"" >$file ... (3 Replies)
Discussion started by: mokachoka
3 Replies

8. Shell Programming and Scripting

Difference between using "echo" builtin and /bin/echo

So in my shell i execute: { while true; do echo string; sleep 1; done } | read line This waits one second and returns. But { while true; do /bin/echo string; sleep 1; done } | read line continues to run, and doesn't stop until i kill it explicitly. I have tried this in bash as well as zsh,... (2 Replies)
Discussion started by: ulidtko
2 Replies

9. Shell Programming and Scripting

difference between echo and ""

hi guys wht is the difference between these two command in bash shell scripting $var1=world! $echo hello $var1 $echo "hello $var1" (8 Replies)
Discussion started by: srinivas2828
8 Replies

10. UNIX for Dummies Questions & Answers

Difference between UNIX operating system and Unix Open Server

Hi, I recently joined this forum and new to UNIX. Is there any difference between UNIX operating system and UNIX open server? Please explain. (1 Reply)
Discussion started by: Manjit
1 Replies
Login or Register to Ask a Question