![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Need help to escape special characters in Korn shell script | rogers42 | UNIX for Dummies Questions & Answers | 6 | 05-14-2009 08:23 AM |
| Bourne Shell: Special characters Input Prevention | totziens | Shell Programming and Scripting | 37 | 04-23-2008 05:05 AM |
| unescaping special characters | sriram_r | Shell Programming and Scripting | 3 | 02-06-2008 07:59 AM |
| special characters | nawnaw | UNIX for Dummies Questions & Answers | 2 | 05-18-2004 04:17 PM |
| awk/sed with special characters | apalex | Shell Programming and Scripting | 5 | 05-06-2002 05:40 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Can't stop shell interpreting special characters
I am struggling with the following sample code: Code:
array1=(a b c d)
array2=(* * * *)
print ${array1[2]}
print ${array2[2]}
It returns 'c' and the name of a file in the directory I'm in. I can't for the life of me work out how to prevent the shell interpreting the '*' and just get it to return the plain character ... is there a way to do this? Also, my Learning the Korn Shell book lists several sed-like functions you can use to edit variable names, e.g. Code:
variable=string
variable=${variable/g/gs}
print $variable
returns 'strings'. But Sed has a function where you can 'store' part of the pattern matched, and get it back in the replacement string, e.g. Code:
print $variable | sed "s/\(strin\)g/\1/" returns 'strin'. Does the Korn shell have a similar feature that's not in my book? |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|