Visit Our UNIX and Linux User Community


Tcsh to sh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Tcsh to sh
# 1  
Old 04-23-2014
Tcsh to sh

Dear all,
I have piece of command from tcsh, which I would like to be in my .bashrc file.
However, I am comletely blank about the tcsh commandline.
Code:
if (-e ~/forum/dir/code.sh) then
source ~/forum/dir/code.sh
endif

Any piece of suggestions how to convert it to sh way?

Thank you
emily
# 2  
Old 04-23-2014
If I get its meaning:

Code:
[ -e ~/forum/dir/code.sh ] && . ~/forum/dir/code.sh

# 3  
Old 04-23-2014
Hello,
Thanks for reply.
A naive question what does '-e' implies?
I assumed it implies if that file ~/forum/dir/code.sh exist than source it. Am I right?

thanks again
emily
# 4  
Old 04-23-2014
That is what it means in SH, yes. In CSH it must mean something similar from the context they're using it -- if the file exists, source it...
# 5  
Old 04-23-2014
Right, -e means the beast exists!
There is also -f: exists as a file (not a directory).
# 6  
Old 04-23-2014
Also see these Reference Cards, B-3 specifically.

Previous Thread | Next Thread
Test Your Knowledge in Computers #791
Difficulty: Easy
Logic gates cannot be used to store data.
True or False?

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help in tcsh script

Hi All, I wrote a tcsh script, but being a beginner it took me lots of efforts and on top of that I am still struggling with little modifications here and there. kindly have a loop. Line1 : I want it to run maximum of "Max" Which I am providing outside loop. So how the "for" should be... (10 Replies)
Discussion started by: nrjrasaxena
10 Replies

2. Shell Programming and Scripting

tcsh help

Does anyone no way my .tcsh_history file is filling up with a bunch of crap?? It is filled with lines like: ! ls eccracrascratcd ! ls mecd /hchoo "cratch2/mecd /sch2/mecd /sh2/mecd /scratchcd /scratch2/mecd /scratcraecd /ls mo "ls" > ! ls eccratch2/mecd /sc/ls"d /scratch2/mecd histecho "ls" o... (2 Replies)
Discussion started by: Bic121
2 Replies

3. Shell Programming and Scripting

tcsh problem

Hi, I'm having a problem getting my terminal history working, I have the following set in my .cshrc file: set history=40 set savehist=40 set histfile=~/.tcsh_history but NO information is being wrote to tcsh_history??? Info: OS - FC14 -rw------- tcsh_history Shell:... (0 Replies)
Discussion started by: Bic121
0 Replies

4. Shell Programming and Scripting

Decimals in TCSH

Hello, I want to run a loop with non-integer values (which I know I can't) so I've created a loop of integers and divided it by 10. However, these values are always rounded down to 1 significant figure. How do I get the script to keep and use the decimal value? My script is as follows #... (1 Reply)
Discussion started by: DFr0st
1 Replies

5. UNIX for Dummies Questions & Answers

About tcsh shell

Hello, Why tcsh shell is not recommended ? then which one is better ? Also can you please let me know how to change own shell and config file? (3 Replies)
Discussion started by: darshakraut
3 Replies

6. UNIX for Dummies Questions & Answers

help in tcsh

am working in tcsh while writing a script, what is diff between foll two starting line #!/bin/csh #!/bin/csh -f Also can I use the same line for script in tcsh or I have to necessarily use #!/bin/tcsh I guess even #!/bin/sh will also do. Kindly clarify (3 Replies)
Discussion started by: mahendrakamath
3 Replies

7. Shell Programming and Scripting

Help me with this tcsh script.!!!!

I need to write a tcsh script which would compare files in the two folders and then send me a mail saying which of the files are missing.For eg 1) I have this folder1 containing all the files which must land on folder2 on a daily basis. 2) If a file is present in folder1 but not in... (6 Replies)
Discussion started by: kumarsaravana_s
6 Replies

8. Shell Programming and Scripting

tcsh

I'm working on OpenOffice Localization; In that I need to work most of in 'tcsh' Since I have almost work till now in 'bash', I want to explore 'tcsh' much more .. An body suggest me a way ? books ? Thanks, :) (1 Reply)
Discussion started by: kartik
1 Replies

9. UNIX for Dummies Questions & Answers

tcsh and redirect

Hello, maybe it is a silly question, but can somebody tell me how to do a redirect of errors in the t shell? Unix Newbie :) (1 Reply)
Discussion started by: Micky
1 Replies

Featured Tech Videos