Right syntax for UNIX CSH as the below in Linux

Hi All,
I am having a hard time finding the right syntax for UNIX CSH as the below in Linux

 
echo $PATH | /bin/grep -v "${JAVA_BINDIR}"
if [ $? -eq 0 ]; then export PATH="${PATH}:${JAVA_BINDIR}"; fi

GLASSFISH_PARENT=/oracle/product/glassfish4
GLASSFISH_HOME=/oracle/product/glassfish4/glassfish
echo $PATH | /bin/grep -q -v "${GLASSFISH_HOME}/bin"
if [ $? -eq 0 ]; then export PATH="${PATH}:${GLASSFISH_HOME}/bin"; fi

Open in new window



echo $SHELL
/bin/csh

Thank you for your help, Bill
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?
 
woolmilkporcConnect With a Mentor Commented:
If you insist - here is the csh version:

echo $PATH | /bin/grep -q -v "${JAVA_BINDIR}"
if ( $status == 0 ) then
     setenv PATH "${PATH}:${JAVA_BINDIR}"
endif

setenv GLASSFISH_PARENT /oracle/product/glassfish4
setenv GLASSFISH_HOME /oracle/product/glassfish4/glassfish

echo $PATH | /bin/grep -q -v "${GLASSFISH_HOME}/bin"
if ( $status == 0 ) then
  setenv PATH "${PATH}:${GLASSFISH_HOME}/bin"
endif

Open in new window

0
 
woolmilkporcCommented:
Why would you want to use csh?

Just add this as the very first line to your script:

#!/bin/bash

and everything will be fine.

wmp
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
I added that but
 if [ $? -eq 0 ] ; then PATH="${PATH}:${JAVA_BINDIR}" ; fi

breaks it
0
 
woolmilkporcCommented:
What is the actual error message?
0
 
BILL CarlisleAPEX DeveloperAuthor Commented:
Thank you that did it!
0
All Courses

From novice to tech pro — start learning today.