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



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 07-18-2008
danmero danmero is offline Forum Advisor  
 

Join Date: Nov 2007
Location: H3X
Posts: 1,565
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"

Sponsored Links
  #9 (permalink)  
Old 07-18-2008
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
 

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


Code:
#!/bin/sh

echo $@
echo $2
root@isau02:/data/tmp/testfeld> ./mach.ksh yo \"yo\"
yo "yo"
"yo"

  #10 (permalink)  
Old 07-18-2008
radoulov's Avatar
--
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 3,210
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"

Sponsored Links
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 Off


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 09:52 PM
escaping double-quotes inside the script? GKnight Shell Programming and Scripting 3 05-05-2008 06: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 05:20 PM



All times are GMT -4. The time now is 09: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-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0