LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 12-20-2011, 03:13 PM   #1
asinghpu
Member
 
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
export BBRROOTSYS=$ROOTSYS
else
echo Directory does not exist: $1
fi



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

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, 08:24 AM   #3
colucix
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
Quote:
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:
http://www.nic.funet.fi/pub/unix/she.../csh-intro.pdf (PDF)
http://www.tldp.org/LDP/Bash-Beginne...tml/index.html
 
  


Reply


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 08:06 AM
Start csh script in the same shell ? Vilius AIX 1 11-18-2008 10:23 AM
converting bash script to csh DJOtaku Programming 8 02-13-2006 06:35 AM
Script for csh or bash unihiekka Programming 5 10-15-2005 10:51 AM
shell confusion..what is diff between bash, ksh, csh, tcsh..?? servnov Linux - Newbie 7 11-18-2004 09:28 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:54 AM.

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