bad substituion error


 
Thread Tools Search this Thread
Operating Systems Solaris bad substituion error
# 1  
Old 04-21-2009
bad substituion error

Dear All
i am getting "bad substituion" error in the follwing piece of code when i run from crontab.however it works if i run directly from my machine.

#!/bin/bash
for i in `cat abc`
do
part1=${i:0:12} ;
part2=${i:13:27} ;
echo "$part1,$part2">> def
done
# 2  
Old 04-21-2009
put this and execute the file..capture output..
btw , this is not the place to post your scripting ques..Smilie
#!/bin/bash -x
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bad substituion error : Dont understand why

Hi Folks - I'm getting the following error message when executing my script: $ chmod +x Winexe_Admin.sh $ ./Winexe_Admin.sh Script Name: Winexe_Admin.sh Script Name without EXT: Winexe_Admin ./Winexe_Admin.sh: line 43: ${_MAINPATH}${_LOGPATH}${LOGPATH$}${_YEAR}_${_MONTH}${_DAY}: bad... (2 Replies)
Discussion started by: SIMMS7400
2 Replies

2. Shell Programming and Scripting

Variable in awk substituion

I have a file with 20 blank spaces. I want to substitute each blank space for a string, and part of that string should include an incremental number Code while read line3 do awk -v var=${line3} '{i=var; sub("^]*$", "\\&\n@target G0.S"'$i'"\n@type xy"); print $0}'... (1 Reply)
Discussion started by: chrisjorg
1 Replies

3. Shell Programming and Scripting

bad substitution error!

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)
Discussion started by: Dendany83
2 Replies

4. Shell Programming and Scripting

bad substitution error in ksh

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)
Discussion started by: LiorAmitai
2 Replies

5. Shell Programming and Scripting

bad substitution error in ksh

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)
Discussion started by: adshocker
5 Replies

6. UNIX for Advanced & Expert Users

Tough Substituion command

I have lines like: Mg2.qns W=0.175u Mg2.qpsb W=0.175u Mg4.qns W=0.175u Mg4.qpsb W=0.175u Which I need to become: Mg2.qns W=wmg2qns Mg2.qpsb W=wmg2qpsb Mg4.qns W=wmg4qns Mg4.qpsb W=wmg4qpsb To acheive this individually line by line I use a command like:... (3 Replies)
Discussion started by: ggggdddd
3 Replies

7. Shell Programming and Scripting

Perl Arrays and Substituion

@xray =~ s/^ *//g; @xray =~ s/ *$//g; @xray =~ s/\s+/ /g; Guess I have a two part question ... First Is there a way to make substitutions, remove leading spaces, trailing spaces, and crunch multiple spaces into a single space, to the entire array, or must the substitutions be done on on... (1 Reply)
Discussion started by: popeye
1 Replies

8. UNIX for Dummies Questions & Answers

'AT: Bad year' error in Irix 4.0.5E

I want to schedule some commands with 'at' on a SGI Indigo running irix 4.0.5. When i give the command : #at 16:00 /usr/bin/blahblah i get a "at: bad year error". The command is exactly according the man page. Also other forms, like 'at now + 1 hour', 'at 16:00 Mar 18', etc gives the same error.... (0 Replies)
Discussion started by: spaantje
0 Replies

9. Shell Programming and Scripting

Env Variable substituion in Sed (-s option)

Folks, I've been trying to use the ENV variable with slashes(/) in its value inside the sed substitution.. Sed 's/myval/'$MYVAL'/' file1 >> file.tmp If MYVAL=<sometext>, it works. if MYVAL=/home/venkat, it doesnt. *************************** bash-2.05$ export VAL=/home/venkat... (5 Replies)
Discussion started by: gvsreddy_539
5 Replies

10. UNIX for Advanced & Expert Users

Bad Number Error

What is wrong with my syntax, I am getting bad number error. The following lines of code get the value from INI file but the variable is a combination of multiple variables. When compiling all together, I get a bad number error or changing the '((' with '{{' gets me bad substitution error. The... (2 Replies)
Discussion started by: moan71
2 Replies
Login or Register to Ask a Question