The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Find cmd not working as expected Vishal123 Shell Programming and Scripting 6 08-29-2007 03:11 AM
Var substitution in awk - not working as expected videsh77 Shell Programming and Scripting 3 01-13-2006 01:57 PM
ls not working as expected within ksh GNMIKE Shell Programming and Scripting 10 07-07-2005 08:53 AM
awk not working as expected with BIG files ... videsh77 Shell Programming and Scripting 1 02-24-2005 04:15 PM
which not working as expected osee Shell Programming and Scripting 2 09-07-2004 12:37 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-12-2006
effigy's Avatar
effigy effigy is offline
Registered User
  
 

Join Date: Aug 2003
Location: IL, USA
Posts: 35
Question #/usr/bin/csh -f not working as expected?

Hey everyone,

A coworker of mine has written a csh script that starts with #!/usr/bin/csh -f. It's my understanding that the -f should skip the .cshrc and .login files, but here's the problem: In the script "line" is used, and I happen to have a "line" in my ~/bin. When the script is ran my ~/bin is still in the path and the script does not work.

Why is ~/bin in my path if csh was instructed not to load the .cshrc and .login files?

I ran a test by renmaing my ".cshrc" file and logging in. When doing so echo $PATH only gave me "/usr/bin:", so it seems the .cshrc is being used.

Thanks for your help.

P.S. I am on Solaris 5.8.

Last edited by effigy; 05-12-2006 at 03:59 PM..
  #2 (permalink)  
Old 05-12-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
#! /usr/bin/csh -f
works for me on solaris. I created a .cshrc with "echo in .cshrc" and wrote a two line csh script with a similiar echo. Without the -f, I get both echo's. Put the -f back in, I get one echo. You must be invoking the script wrong... see: What does "#! /usr/bin/ksh" mean?
  #3 (permalink)  
Old 06-02-2006
effigy's Avatar
effigy effigy is offline
Registered User
  
 

Join Date: Aug 2003
Location: IL, USA
Posts: 35
Thanks for the reply, and sorry for the delay: I was on vacation. Here is some more information:

1. There is also a "b" switch, but this shouldn't affect the "f"? ("-fb")
2. The script is called from a third-party application; how it does it, I'm not sure. I imagine this could be a factor, but how can one call a shell script without honoring the switches?

Thanks for your help.
  #4 (permalink)  
Old 06-02-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,131
Looking again at your first post, you tested that renaming .cshrc had the expected effect while logging in. Which proves nothing at all with respect to the third party script. Why not rename your .cshrc, then try that third party script? It may not be running your .cshrc at all. Maybe your bin directory is already in your PATH. If so, refraining from running your .cshrc again will avoid putting a second copy of your bin directory in your PATH. But that will not magicly remove a copy already there. This is why Bill Joy split out .login from .cshrc. You should not fiddle with your environment every time you run a script.
  #5 (permalink)  
Old 06-05-2006
effigy's Avatar
effigy effigy is offline
Registered User
  
 

Join Date: Aug 2003
Location: IL, USA
Posts: 35
I did the following:

1. Renamed my .cshrc.
2. Logged into a new terminal window.
3. Ran the app's .cshrc file.
4. Added /usr/openwin/bin to my path, as required by the script.
5. Ran the shell script via the application.

It works as expected; my "line" is not seen.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0