The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
execute a command silently or quietly within a shell lumix Shell Programming and Scripting 4 12-15-2007 03:10 PM
execute shell command in perlscript amitrajvarma Shell Programming and Scripting 0 11-27-2007 02:49 AM
Execute internal script as different user aubtc Shell Programming and Scripting 6 09-12-2007 12:51 PM
Maint user cannot execute ping command kabeer_n UNIX for Dummies Questions & Answers 3 10-23-2006 11:01 PM
How to execute shell Script? siva Shell Programming and Scripting 3 05-14-2002 11:07 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-30-2008
redtiger redtiger is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 1
Question shell script to execute user command

I don't know why the following shell script doesn't work. Could you please help me out?

#!/usr/bin/ksh

test="cal > /tmp/tmp.txt 2>&1"
$test


I know it will work for the following format:

#!/usr/bin/ksh

cal > /tmp/tmp.txt 2>&1

However, I need to get the command from the user in my script, so I have to save this command including arguments in a variable.

Thanks
  #2 (permalink)  
Old 04-30-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
eval $test
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0