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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 11-06-2009
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,434
You can also do :
Code:
#!/bin/ksh -x

OriginalString='-p/usr/home/dfusr/adm/props/Comments.properties_-iPEL17'

oldIFS="$IFS" ; IFS=
set -A cmdLineArgs -- $OriginalString
IFS="$oIFS"

echo "cmdLineArgs[0]:::::::: ${cmdLineArgs[0]}"
echo "cmdLineArgs[1]:::::::: ${cmdLineArgs[1]}"

I have also tried :
Code:
IFS=_ set -A cmdLineArgs -- $OriginalString

The problem is that this command works fine at the prompt, but not from a script file. Somebody can explain that ?

Jean-Pierre