if below notation is not suport byt KSH version M-11/16/88f
what is the alternative i can use
FILE_PREFIX=${fileNAme:$len:4}: 0403-011 The specified substitution is not valid for this command.
if below notation is not suport byt KSH version M-11/16/88f
what is the alternative i can use
FILE_PREFIX=${fileNAme:$len:4}: 0403-011 The specified substitution is not valid for this command.
You can use these:
${var#<regexp>}
${var##<regexp>}
${var%<regexp>}
${var%%<regexp>}
Since you want a "substring"-function you may be interested in knowing you can nest these expansions like i.e. this:
${var##{var%%??}} # only the last 2 characters of any string
${var%%{var##??}} # only the first 2 characters of any string
You can use these or similar for subsequent expansions, i.e.:
${var:2:3} # substring in ksh93-notation to emulate
var=${var##??} # cut off first two characters
${var%%${var##???}} # display first 3 characters of resulting string
From the version string of your ksh88 i guess you use AIX. You have a ksh93 available per default in /usr/bin/ksh93
.
I hope this helps.
bakunin
how to enable /usr/bin/ksh93
can it be refer only to script
#!/usr/bin/ksh93 etc
As with any other command interpreter you can specify it in the "shebang" line:
#!/usr/bin/ksh93
In fact you should do that always, not only for ksh93.
You can also start ksh93 on the command line for interactive use by issuing:
/usr/bin/ksh93
or, if /usr/bin
is included in your PATH (which most probably is the case) just:
ksh93
I hope this helps.
bakunin
Expanding a little bit on what bakunin has already said...
If a script's first line is:
#!/usr/bin/ksh93
and that script is made executable such as by:
chmod +x script_pathname
then whenever you run that script by invoking its name, it will be run by ksh93
. Whether or not you do that, if you issue the command:
ksh93 script_pathname argument...
that will run script_pathname with the given command line arguments using ksh93
to interpret script_pathname no matter what any #!
on the first line in that file might request be used as its interpreter as long as /usr/bin
is in your PATH
environment variable.
If you issue the command:
exec ksh93
your currently running shell will be replaced by an invocation of ksh93
and it will be used to interpret any interactive commands you issue in that terminal session until terminate that shell.
If you issue the command:
ksh93
and /usr/bin
is in your PATH
environment variable, you will start another shell running in the current shell execution environment and it will be used to interpret any interactive commands you issue until you terminate that shell (and then you'll resume the previous shell session.
If you issue the command:
chsh /usr/bin/ksh93
and it works, then the next time you login to your system, your login shell will be ksh93
and it will remain in place as your login shell on that system until you run chsh
again.