The UNIX and Linux Forums  


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
unique sort contents of a variable praveenbvarrier Shell Programming and Scripting 2 05-20-2008 08:12 AM
Save contents of a Variable carl_vieyra UNIX for Dummies Questions & Answers 1 02-27-2007 12:27 AM
adding contents of file dakid UNIX for Dummies Questions & Answers 4 10-20-2006 03:24 PM
How to adding the filename into file contents missutoomuch Shell Programming and Scripting 2 11-11-2005 05:26 AM
echo contents of differing variable names gefa Shell Programming and Scripting 2 05-24-2005 08:49 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2005
gammarays gammarays is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 5
adding contents of a variable to a command

hi all,

i'm new to shell scripting, so i'm not sure how to work this. Is it possible to read in the contents of a variable and add it to a command? for example:

------------------------
#!/bin/sh

set example = -dfr

rm ${example}
------------------------
when i run the script, i want it to do a rm -dfr. Right now, it doesn't seem to work, and i'm not sure what i'm doing wrong
  #2 (permalink)  
Old 02-07-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,127
Use the syntax:
example="-dfr"

No spaces around the equal sign.
  #3 (permalink)  
Old 02-08-2005
gammarays gammarays is offline
Registered User
  
 

Join Date: Feb 2005
Posts: 5
Smile

thanks, that was helpful
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 12:03 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