Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Bad substituion error : Dont understand why Post 302985002 by SIMMS7400 on Thursday 3rd of November 2016 12:41:48 PM
Old 11-03-2016
Bad substituion error : Dont understand why

Hi Folks -

I'm getting the following error message when executing my script:

Code:
[oracle@exalytics-madc-01 Batch]$ chmod +x Winexe_Admin.sh
[oracle@exalytics-madc-01 Batch]$ ./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 substitution
mkdir: missing operand
Try `mkdir --help' for more information.

My script is as follows:

Code:
#!/bin/bash
#:: ------------------------------------------------------------------------
#::-- Script Name: .sh
#::  
#::-- Description: 
#:: 
#::-- Parameters:  Call properties file to get environment variables to determine 
#::                login info, database, application, etc.
#::        
#::-- Author:       
#::-- Date:           10/22/16
#:: ------------------------------------------------------------------------
#source /app/hyp_app/scripts/setenv.sh

#::-- Set Script Name --::
_SN=${0##*/}

echo "Script Name: $_SN"
echo "Script Name without EXT: ${_SN%%.sh*}"

#::-- Set Path Variables --::
_MAINPATH=/u01/Hyperion_Batch/
_LOGPATH=Logs/
_ERRORPATH=Errors/

#::-- Set Log & Error subdirectory pertaining to specific process --::

_PLOGPATH=LCM_Logs/
_PERRORPATH=LCM_Errors/

#::-- Set Date and Time Variable --::
_DAY=$(date +%d)
_MONTH=$(date +%m)
_YEAR=$(date +%Y)
_DATESTAMP=${_YEAR}${_MONTH}${_DAY}
_HOUR=$(date +%H)
_MINUTE=$(date +%M)
_SECOND=$(date +%S)
_TIME=${_HOUR}${_MINUTE}
_DATETIMESTAMP=${_DATESTAMP}_${_TIME}

#::-- Establish Log and Error File Directories --::
_ARC_LF=${_MAINPATH}${_LOGPATH}${LOGPATH$}${_YEAR}_${_MONTH}${_DAY}
_ARC_EF=${_MAINPATH}${_ERRORPATH}${_PERRORPATH}${_YEAR}_${_MONTH}${_DAY}
    mkdir -p ${_ARC_LF}
    mkdir -p ${_ARC_EF}

#::-- Prepare File Name Format --::    
_FN=${_TIME}_${_SN%%.sh*}

#::-- Establish standard out and standard error --:: 
_LF=${_ARC_LF}/${_FN}.log
_EF=${_ARC_EF}/${_FN}.err

#::-- Establish LCM Specifics --::

#::-- Set Process Variables --::#
_WINEXE_PATH=/u01/Hyperion_Batch/Scripts/Utilities/Winexe/winexe-1.00/source4/bin/


exec 2>${_EF} > ${_LF}

#:: Begin Script Processing --::
echo ---------------------------------------------------------
echo "Begin ${_SN%%.sh*} Process at ${_TIME}"                           
echo                                                                                                        
echo "Execute Winexe Process on Windows Server"                                         
echo ---------------------------------------------------------

${_WINEXE_PATH}winexe -U ‘domain/username%password!' //server 'cmd.exe /c  C:\Hyperion_Batch\Scripts\batch\WinexeTest.cmd'

if [ $? -eq 0 ]
then
  echo ---------------------------------------------------------
  echo "Execute Winexe Process on Windows Server Successful"                           
  echo ---------------------------------------------------------
  #::-- If empty, delete YYYY_MMDD error file subdirectory --::
  trap "[ -s ${_EF} ] || rm -f ${_EF} ] && rmdir ${_ARC_EF}" EXIT 0
  
else
  echo ---------------------------------------------------------
  echo "Execute Winexe Process on Windows Server Unsuccessful"                      
  echo ---------------------------------------------------------
  fi
  exit 1

I thought at first it was interpreter but I confirm its correct. Thanks for any input!!
 

10 More Discussions You Might Find Interesting

1. What is on Your Mind?

dont understand

i'm trying to learn unix and i posted a question and what i was typing from school. i can't figure it out. how am i supposed to learn , when i get shutdown by an admin. for posting a homework question. doesn't make any sense. its a dumb rule. thanks for helping (4 Replies)
Discussion started by: AtomJ22
4 Replies

2. 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

3. 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

4. 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

5. Solaris

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 (1 Reply)
Discussion started by: asadlone
1 Replies

6. Shell Programming and Scripting

I can't understand sed error output.

Hey forum, I have a problem with a script what used to work, but suddenly is not working anymore. I have been trying different things for an hour now and I give up :D . #!/bin/sh asukoht=`pwd` template=$1 for values in... (4 Replies)
Discussion started by: mario8eren
4 Replies

7. Programming

Need help with this c++ source code! DOnt understand what some stuff mean.

Okay so I am just starting programming c++. I just started started to red "C++ for Dummies yesterday and theres a lot of things I do not understand from this book and this source code especially. I will first post the full source code and then post questions about certain thing, usually what they... (2 Replies)
Discussion started by: orszhak
2 Replies

8. UNIX for Dummies Questions & Answers

i dont know how to solve this error

can while do make aloop as do while in c language ? (1 Reply)
Discussion started by: teefa
1 Replies

9. 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

10. Shell Programming and Scripting

Trying to understand perl error

I am trying to begin to troubleshoot this perl error that I keep getting, yet I get output is produced. The error is Use of uninitialized value in join or string line 175, <MANNO> line 7138 and below is line 175: I am not too sure what the error is but since not every line has an error on it, I... (1 Reply)
Discussion started by: cmccabe
1 Replies
ppmtosixel(1)						      General Commands Manual						     ppmtosixel(1)

NAME
ppmtosixel - convert a portable pixmap into DEC sixel format SYNOPSIS
ppmtosixel [-raw] [-margin] [ppmfile] DESCRIPTION
Reads a portable pixmap as input. Produces sixel commands (SIX) as output. The output is formatted for color printing, e.g. for a DEC LJ250 color inkjet printer. If RGB values from the PPM file do not have maxval=100, the RGB values are rescaled. A printer control header and a color assignment table begin the SIX file. Image data is written in a compressed format by default. A printer control footer ends the image file. OPTIONS
-raw If specified, each pixel will be explicitly described in the image file. If -raw is not specified, output will default to com- pressed format in which identical adjacent pixels are replaced by "repeat pixel" commands. A raw file is often an order of magni- tude larger than a compressed file and prints much slower. -margin If -margin is not specified, the image will be start at the left margin (of the window, paper, or whatever). If -margin is speci- fied, a 1.5 inch left margin will offset the image. PRINTING
Generally, sixel files must reach the printer unfiltered. Use the lpr -x option or cat filename > /dev/tty0?. BUGS
Upon rescaling, truncation of the least significant bits of RGB values may result in poor color conversion. If the original PPM maxval was greater than 100, rescaling also reduces the image depth. While the actual RGB values from the ppm file are more or less retained, the color palette of the LJ250 may not match the colors on your screen. This seems to be a printer limitation. SEE ALSO
ppm(5) AUTHOR
Copyright (C) 1991 by Rick Vinci. 26 April 1991 ppmtosixel(1)
All times are GMT -4. The time now is 08:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy