Hello, I was hoping for a second pair of eyes or a little bit of help figuring out what my error is in a script. I did some searching in the forums and didn't find anything so please forgive me if it a similar problem has been discussed before.
My script accepts normal user arguments; however,... (2 Replies)
Hi All,
We are in the process of Migrating from AIX 4 to Solaris 10 and getting a Few Errors.
I have been programming in shell but could never establish muself as an expert, hence please need you help.
I am Getting Bad Substitution error in my script, I have isolated the issue and its... (6 Replies)
hi,
i created a shell script having the following content:
#! /usr/bin/ksh
FROM="myemail@domain.com"
MAILTO="someemail@domain"
SUBJECT="TEST"
BODY="/export/home/adshocker/body.txt"
ATTACH="/export/home/adshocker/attach.prog"
echo $ATTACH
ATTACH_NAME="${ATTACH##*/}"
echo $ATTACH_NAME... (5 Replies)
Hello,
In bash I can use the following:
TMP=12345
MID=${TMP:1:1}
the expected result is: 2
but when using KSH I'm getting a ''bad substitution" error.
What is the correct syntaxin ksh?
Thanks (2 Replies)
#!/bin/bash
a1=( win 12,01,02,03,04 )
a2=( pre 04,05,06 )
a3=( msn 06,07,08,09 )
Given the above arrays, I want the script to return/echo the following in a loop;
win
12,01,02,03,04
pre
04,05,06,07
msn
06,07,08,09
But I can't get it to do as such.
I've tried; (2 Replies)
Hi All,
I'm building a new shell script but i'm facing a problem with one line which is giving "bad substitution" error. Please assist
script lines:
#!/bin/sh
printf "%s: " "Occurrence DATE (YYYYMMDD)"; read DATE
shortdate=${DATE#??}
o/p:
./test1: bad substitution
This command is... (2 Replies)
Hi guys. Good day, morning, afternoon or night, depending on where you live.
I have a script shell in which I am looping on files (absolute path) see code section above.
I always have an error: bad substitution.
:wall:
Is it because my variable file is the index of the loop and not a normal... (4 Replies)
Why I get bad replace when using eval?
$ map0=( "0" "0000" "0")
$ i=0
$ eval echo \${map$i}
0000
$ a=`eval echo \${map$i}` !!!error happens!!!
bash: ${map$i}: bad substitution
How to resolve it ?
Thanks! (5 Replies)
Hi I'm using ksh.
And i'm trying to get the substring like below.
but giving the following error
#!/bin/ksh
foo=teststring
bar=${foo:0:5}
echo $bar
And the error is
./sbstr_test.sh: bar=${foo:0:5}: bad substitution
what is wrong in this script. Please correct me
... (3 Replies)
I want to get the last character from my machine name using the following code, the default shell is bash, the script runs in ksh.
I get 'bad' substitution error on running the script, but works fine if run using dot and space.
Why?
$ echo $0
bash
$ cat -n myenv.sh
1 ... (8 Replies)
Discussion started by: ysrini
8 Replies
LEARN ABOUT DEBIAN
shcomp
SHCOMP(1) User Environment Utilities SHCOMP(1)NAME
shcomp - compile a ksh93 shell script
SYNOPSIS
shcomp [ options ] [infile] [outfile]]
ORIGIN OF THIS MAN PAGE
This man page was written by Christophe Martin <Schplurtz@free.fr> for the Debian GNU/Linux system. It is based on "shcomp --man" output.
DESCRIPTION
Unless -D is specified, shcomp takes a shell script, infile, and creates a binary format file, outfile, that ksh93 can read and execute
with the same effect as the original script.
Since aliases are processed as the script is read, alias definitions whose value requires variable expansion will not work correctly.
If -D is specified, all double quoted strings that are preceded by $ are output. These are the messages that need to be translated to
locale specific versions for internationalization.
If outfile is omitted, then the results will be written to standard output. If infile is also omitted, the shell script will be read from
standard input.
OPTIONS -D, --dictionary
Generate a list of strings that need to be placed in a message catalog for internationalization.
-n, --noexec
Displays warning messages for obsolete or non-conforming constructs.
-v, --verbose
Displays input from infile onto standard error as it reads it.
--man Displays this man page on standard error and exits.
--help Shows a short help message and exits.
EXIT STATUS
0 Successful completion.
>0 An error occurred.
DEBIAN WARNING
On a Debian GNU/Linux system, more than one package may provide ksh. the output of shcomp can only be used by ksh93. Any other ksh will be
unable to run the compiled script.
EXAMPLE
( echo '#! /bin/ksh93' ; shcomp myscript ) > myscript.bin &&
chmod 755 myscript.bin
./myscript.bin
SEE ALSO ksh(1)IMPLEMENTATION
version shcomp (AT&T Labs Research) 2012-02-29
author David Korn <dgk@research.att.com>
copyright Copyright (c) 1982-2012 AT&T Intellectual Property
license http://www.eclipse.org/org/documents/epl-v10.html
KSH93 Fri Jun 3 2005 SHCOMP(1)