Sponsored Content
Top Forums Shell Programming and Scripting namerefs alternative for KSH88 Post 302705471 by elixir_sinari on Tuesday 25th of September 2012 01:57:10 AM
Old 09-25-2012
You could try:
Code:
$ STRING1='ABC    XYZ'
$ NEWVAR=STRING1
$ eval 'echo NEWVAR IS ACTUALLY "$'$NEWVAR'"'
NEWVAR IS ACTUALLY ABC    XYZ

as a workaround. But, if I were you, I would change my shell to one that supports namerefs...
This User Gave Thanks to elixir_sinari For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh88 - curses

I was wondering if there is anyway to use the curses library with ksh88. I saw Shell Curses function library which says I can use /usr/local/functions/shellcurses on ksh93 but I am on ksh88. I am on a HP-UX box. (0 Replies)
Discussion started by: IMTheNachoMan
0 Replies

2. Shell Programming and Scripting

ksh88 or ksh93

Hi all! Does anybody know how can I check if any UNIX installation has implemented ksh88 or ksh93? Thanks in advance. Néstor. (3 Replies)
Discussion started by: Nestor
3 Replies

3. Shell Programming and Scripting

Substring in ksh88 ?

Hello, ksh88 doesn't support ${var:x:y}. Any alternatives to get substring ? thanks Vilius (2 Replies)
Discussion started by: vilius
2 Replies

4. Shell Programming and Scripting

Download AT&T ksh88 ?

Hello, I need ksh88 for my linux system - and I don't want pdksh. Possible to get original ksh 88 binaries or source ? (I don't need ksh93 which is available) thanks Vilius (1 Reply)
Discussion started by: vilius
1 Replies

5. Shell Programming and Scripting

[ksh88 and awk] Number of fields with a value.

Hi, With: # VALUES="one~two~~~" # echo $VALUES | awk 'BEGIN {FS="~"} {print NF}' 5 I can determine the number of fields. How to determine the number of fields with a value ? In this case 2. Thanks in advance, ejdv (6 Replies)
Discussion started by: ejdv
6 Replies

6. Shell Programming and Scripting

Comparing Strings in ksh88

Hi I tried the following string comparison script in Ksh88 #!/bin/ksh str1='aC' str2='ABC' if then echo "Equal" else echo "Not Equal" fi Though str1 and str2 are not equal the script output says Equal . Please correct me Thanks (2 Replies)
Discussion started by: smile689
2 Replies

7. Shell Programming and Scripting

Zip size is different though files are same in ksh88

I'm using Ksh88 . I've last day files in one directory and current month files in another directory , having the same naming convention. Now i need to compare these folders size , if there is no change in these files then no action to be performed else if there is a change then i need to call... (1 Reply)
Discussion started by: smile689
1 Replies

8. Shell Programming and Scripting

FTP script in ksh88

Hi I tried the following code to FTP the files from test server to dev #!/bin/ksh DST=/home/files cd $DST ftp -inv 'test_serv101' << EOF quote USER test quote PASS test # File Path on test server cd /etc/home/Or_Files ascii mget curMonth* $DST quit EOF when i try the above code it... (4 Replies)
Discussion started by: smile689
4 Replies

9. Solaris

Solaris scripting problem with ksh88

Hello, I want to pick a random element from a list, and created these 2 lines, which work very well in ksh93. Unfortunately, I get this "bad substitution" message in ksh88. I'm wondering if there's an equivalent to the second line of my script.. or if I have to install ksh93 to make this... (8 Replies)
Discussion started by: gfroute
8 Replies

10. OS X (Apple)

FFT for the AMIGA through ksh88 shell.

I don't know if anyone is interested but I have been meddling with FFT for the AMIGA. (Sadly we AMIGAns don't have these luxuries through any scripting language. Below is a Python snippet that uses the builtin 'cmath' module to work with the lowly Python 2.0.1 for the AMIGA. It is part of a... (0 Replies)
Discussion started by: wisecracker
0 Replies
SHELL-QUOTE(1p) 					User Contributed Perl Documentation					   SHELL-QUOTE(1p)

NAME
shell-quote - quote arguments for safe use, unmodified in a shell command SYNOPSIS
shell-quote [switch]... arg... DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands or files with embedded white space or shell globbing characters safely. Here are a few examples. EXAMPLES
ssh preserving args When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and passes them to "$SHELL -c". This doesn't work as intended: ssh host touch 'hi there' # fails It creates 2 files, hi and there. Instead, do this: cmd=`shell-quote touch 'hi there'` ssh host "$cmd" This gives you just 1 file, hi there. process find output It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote: eval set -- `find -type f -print0 | xargs -0 shell-quote --` debug shell scripts shell-quote is better than echo for debugging shell scripts. debug() { [ -z "$debug" ] || shell-quote "debug:" "$@" } With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can. save a command for later shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are things the user can't pass through), you can do something like this: user_switches= while [ $# != 0 ] do case x$1 in x--pass-through) [ $# -gt 1 ] || die "need an argument for $1" user_switches="$user_switches "`shell-quote -- "$2"` shift;; # process other switches esac shift done # later eval "shell-quote some-command $user_switches my args" OPTIONS
--debug Turn debugging on. --help Show the usage message and die. --version Show the version number and exit. AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions. AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.4 2005-05-03 SHELL-QUOTE(1p)
All times are GMT -4. The time now is 10:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy