Solved

Right syntax for UNIX CSH as the below in Linux

Posted on 2013-12-02
5
473 Views
Last Modified: 2013-12-02
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
0
Comment
Question by:bcarlis
  • 3
  • 2
5 Comments
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39690329
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
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39690363
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
 
LVL 2

Author Comment

by:bcarlis
ID: 39690382
I added that but
 if [ $? -eq 0 ] ; then PATH="${PATH}:${JAVA_BINDIR}" ; fi

breaks it
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39690388
What is the actual error message?
0
 
LVL 2

Author Comment

by:bcarlis
ID: 39690400
Thank you that did it!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How code a 301 redirect for folder files -> 1 file 2 40
Backup Raspberri Pi over the netowrk to a Windows Share 5 42
SonarQube on Linux vs Windows 3 27
bash file 10 37
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Utilizing an array to gracefully append to a list of EmailAddresses
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question