Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 12-20-2011, 02:13 PM   #1
Registered: Mar 2010
Location: India
Posts: 32

Rep: Reputation: 15
converting bash script to csh shell

Hi all

I am not familiar with bash or c shell programming. I have one software which is in bash shell but my work server and all related software are in C shell . So i want to convert my bash shell script to c shell script.

if [ -d "$1" ]; then
export PATH=`echo :$PATH:| sed -e 's/:[^:]*root[^:]*:/:/g' -e 's/^://g' -e 's/ .$//g' -e 's/:$//g'`:$1/bin
export LD_LIBRARY_PATH=`echo :$LD_LIBRARY_PATH:| sed -e 's/:[^:]*root[^:]*:/:/g' -e 's/^://g' -e 's/ .$//g' -e 's/:$//g'`:$1/lib
export ROOTSYS=$1
echo Directory does not exist: $1

Old 12-21-2011, 07:23 AM   #2
Senior Member
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 13.1
Posts: 1,330

Rep: Reputation: 254Reputation: 254Reputation: 254
Why do you want to convert them, when you are not modifying them at all? In fact, I would tend more to change the csh scripts to bash ones.
Old 12-21-2011, 07:24 AM   #3
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Originally Posted by asinghpu View Post
So i want to convert my bash shell script to c shell script.
What have you tried? Where are you stuck? The conversion should be trivial, since it is only a matter of different syntax, for example the C-shell uses parentheses in place of the square brackets for tests.

Regarding the sed commands you have only to be sure they work flawlessly on both machines, since you may have different versions. If GNU sed is installed on both, you're safe. In any case nothing to do with the shell, since sed is an external command.

Here are some useful links that may serve as a starting point: (PDF)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash/csh shell in gvim vijay_babu1981 Linux - Software 1 04-08-2010 07:06 AM
Start csh script in the same shell ? Vilius AIX 1 11-18-2008 09:23 AM
converting bash script to csh DJOtaku Programming 8 02-13-2006 05:35 AM
Script for csh or bash unihiekka Programming 5 10-15-2005 09:51 AM
shell confusion..what is diff between bash, ksh, csh, tcsh..?? servnov Linux - Newbie 7 11-18-2004 08:28 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration