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
Double quotes or single quotes when using ssh? password636 Shell Programming and Scripting 3 05-29-2008 08:52 PM
escaping double-quotes inside the script? GKnight Shell Programming and Scripting 3 05-05-2008 05:35 PM
Bash Shell - # of arguments DNAx86 Shell Programming and Scripting 1 01-10-2008 01:23 PM
Bash: Reading 2 arguments from a command line Vozx Shell Programming and Scripting 0 12-08-2005 05:23 PM
retain Line numbers.. in Vi .. OR .. A SHELL SCRIPT sdlayeeq Shell Programming and Scripting 2 04-26-2005 04:20 PM

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 07-18-2008
danmero danmero is offline Forum Advisor  
  
 

Join Date: Nov 2007
Location: 45.48-73.63
Posts: 1,420
Quote:
Originally Posted by zaxxon View Post
Hm..
Code:
./mach.ksh yo \"yo\"
  yo "yo"
cat mach.ksh
  echo $@
Works with ksh and bash. What shell do you use?
Try to echo $2 in your script
Code:
cat mach.ksh
  echo $@
  echo "$2"
  #2 (permalink)  
Old 07-18-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
  
 

Join Date: Sep 2007
Location: Germany
Posts: 2,259
Yes and ?

Code:
#!/bin/sh

echo $@
echo $2
root@isau02:/data/tmp/testfeld> ./mach.ksh yo \"yo\"
yo "yo"
"yo"
  #3 (permalink)  
Old 07-18-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
I'd not use a code like this (you know, eval could be very dangerous), but given the original requirement this should work:
Code:
#!/usr/bin/bash

commandToRun="$(printf "%q " "$@")"

eval "$commandToRun t.txt"
Closed Thread

Bookmarks

Tags
bash, bash eval, eval, linux

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 03:50 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