Sponsored Content
Top Forums Shell Programming and Scripting Using ".." to change directories in a ksh script Post 302720733 by joe cipale on Wednesday 24th of October 2012 02:38:00 PM
Old 10-24-2012
code snippet

I can post a portion. It is basically proprietary corp code.

Code:
#------------------------------------------------------------------
# Parse the command-line args
#------------------------------------------------------------------

while getopts "s:g:v:q:" flag
    do
        case $flag in
        s) srp_path=$OPTARG
           print "base release        : " $test_path
           ;;
        g) grp_path=$OPTARG
           print "support release        : " $spt_path
           ;;
        v) vers=$OPTARG
           print "support version        : " $vers
           ;;
        q) prd_path=$OPTARG
           print "product path       : " $prd_path
           ;;
: )          echo "$0: $OPTARG option missing argument..."
           exit 2
           ;;
        [?]) print >&2 "Usage: "$USAGE
           exit 1
           ;;

        esac
    done
shift $OPTIND-1

#------------------------------------------------------------------
# Check the correctness of the cmd-line values
#------------------------------------------------------------------

mypath=`pwd`
echo "DBG - my path is: " $mypath

#rbase=../../../lib/$test/profiles
#rbase=$mypath/../../../lib/$test/profiles
rbase=${PWD%/*/*/*}/lib/$test/profiles

# debug 
cd $rbase
rpath=`pwd` 
print "DBG - current path is: " $rpath

tbase=$tbase/$test
#rbase=$rbase/$test

print "DBG - Base path is: " $tbase
print "DBG - Regression path is: " $rbase

if [[ -d $tbase ]]; then
    # search paths
    test_path=$base/SOLUTION/$test/profiles
    print "DBG - path is: $test_path
elif [[ -d $rbase ]]; then
    # regression search paths
    #test_path=$rbase
    print "DBG - test path is: $rbase
else
print "The specified path does not exist..."
    exit 1
fi

The commented out bits of code are methods I have attempted and I would like to keep track of them for now.

Thanks folks.

Last edited by Corona688; 10-24-2012 at 04:17 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script as a login shell return "no controlling terminal"

I have created a ksh shell script and used it as a login shell for a user. </etc/passwd> lramirev:x:111:200:Luis:/export/home/menush:/usr/local/menush/menush My shell script is like this: </usr/local/menush/menush> #!/bin/ksh # if ] then . $HOME/.profile fi ... (8 Replies)
Discussion started by: lramirev
8 Replies

2. HP-UX

script running with "ksh" dumping core but not with "sh"

Hi, I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone. And its not dumping core if we run the script using "/bin/sh" instead of "ksh" Can some body please help me how to resolve this issue. ... (9 Replies)
Discussion started by: simhe02
9 Replies

3. Shell Programming and Scripting

Ksh script function, how to "EXIT 2" without killing the current process?

Hi, Using AIX 5.3 and Ksh. />ls -al /usr/bin/ksh -r-xr-xr-x 5 bin bin 237420 Apr 10 2007 /usr/bin/ksh /> I recently started working for a new employer. I have written UNIX K-Shell scripts for many years and have never had this particular issue before. Its perplexing me. I have... (2 Replies)
Discussion started by: troym72
2 Replies

4. Shell Programming and Scripting

ksh-script "arithmetic syntax error" comparing strings

Hi all, I´ve already searched the forum but can´t find what i am doing wrong. I am trying to compare two variables using ksh under red hat. The error I get is: -ksh: .: MDA=`md5sum /tmp/ftp_dir_after_transfer | cut -d' ' -f1 ` MDB=`md5sum /tmp/ftp_dir_before_transfer | cut -d' ' -f1 `... (3 Replies)
Discussion started by: old_mike
3 Replies

5. Shell Programming and Scripting

Help to change the file with "sed" and "awk"

Hi experts I want your help to change the file format to my wanted version, please give me a hand thanks $cat file install pass make os pass make build kernel failed usb storage pass chane to | *install* | *make os* | *make build kernel* | *usb storage* | | pass | pass... (7 Replies)
Discussion started by: yanglei_fage
7 Replies

6. Shell Programming and Scripting

Purpose of "read" and "$END$" in ksh ?

Hi, Could anyone please shed some light on the following script lines and what is it doing as it was written by an ex-administrator? cat $AMS/version|read a b verno d DBVer=$(/usr/bin/printf "%7s" $verno) I checked that the cat $AMS/version command returns following output: ... (10 Replies)
Discussion started by: dbadmin100
10 Replies

7. Shell Programming and Scripting

Awk,sed : change every 2nd field ":" to "|"

Hi Experts, I have a string with colon delimited, want 2nd colon to be changed to a pipe. data: 101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3: I am trying with sed, but can change only 1 occurance: echo "101:8:43:4:72:14:41:69:85:3:137:4:3:0:4:0:9:3:0:3:12:3:" | sed 's/:/|/2'... (5 Replies)
Discussion started by: rveri
5 Replies

8. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

9. Shell Programming and Scripting

How to fix this "Input is not UTF-8" while executing ksh script?

Hi, I have an automated script which have set of sqls but when i am trying to execute the automated script by using nohup command, it is throwing an error like "Input is not UTF-8" . And when i digged in to it, i am getting some "Â" character in the shell script. How to avoid this!? Thanks. (1 Reply)
Discussion started by: Samah
1 Replies

10. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies
GP2C-DBG(1)							       PARI							       GP2C-DBG(1)

NAME
GP2C-DBG - The GP to C debugger driver DESCRIPTION
gp2c-dbg [gp2c options] [file.gp] Compile file.gp with gp2c and launch a debugger session of gp where the functions of file.gp are loaded. [gp2c options] are passed to gp2c. gp2c-dbg file.c Compile file.c and launch a debugger session of gp where the functions of file.c are loaded. The file file.c must have suitable GP;install() lines. USAGE
Since there is no debugger for the GP language, gp2c-dbg allows to debug GP scripts with the C debugger. To catch PARI errors, you can set a break point on the function "pari_err". Note that your functions will not be loaded until gp read the .run file. FILES
file.gp.c The C output of gp2c. file.gp.so The GP loadable module. file.gp.run The commands to load the module. Once a module is compiled, you can load it inside a gp session by running this script. ENVIRONMENT
GP2C Path to the gp2c compiler, default: /usr/bin/gp2c GP_DBG Path to the gp calculator, default: /usr/bin/gp GP2C_DBG Command to start the debugger, default: "gdb --args" COPYING
Copyright 2000-2006 The PARI Group GP2C is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. There is absolutely no warranty for GP2C. SEE ALSO
The GP2C manual, gp2c-run(1), gp2c(1), gp(1), gdb(1) GP to C compiler driver November 2001 GP2C-DBG(1)
All times are GMT -4. The time now is 02:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy