User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Linux question - csh scripting Page [1]  
Wyloch
All American
4244 Posts
user info
edit post

Since the program we need for senior design is only on a Linux machine, we are forced to use the most worthless operating system on the planet.

Anyways, we need to execute four lines every time we log in so that we can run this program:
% setenv SYS sun5
% setenv SCM /afs/bp/dist/helios/scm
% source $SCM/Command/scmrc
% setenv LD_LIBRARY_PATH /afs/bp/dist/forte/SUNWspro/lib:$LD_LIBRARY_PATH

So I wrote a shell script:
----
#!/bin/csh
setenv SYS sun5
setenv SCM /afs/bp/dist/helios/scm
source $SCM/Command/scmrc
setenv LD_LIBRARY_PATH /afs/bp/dist/forte/SUNWspro/lib:$LD_LIBRARY_PATH
echo Complete.

The output, as expected is "Complete," alas it did not work, because after entering these four lines the program is supposed to run. Note that when I enter the four lines manually (ie - not through a script), the program will run fine.

'setenv' is supposed to set an environment variable that "does not vanish once the script is complete." Yet, when the script is complete, I checked to see what was assigned to SYS via:
% $SYS
And I get '$SYS: Command not found'
Same story for the variable SCM. Why doesn't 'setenv' work properly? Anyone know why the environment variables vanish after the script is complete, even though they are by definition not supposed to?

2/7/2007 6:14:47 PM

A Tanzarian
drip drip boom
10994 Posts
user info
edit post

Sometimes scripts are weird in that changes you make in the script only apply to the process that is running the script. When your process/script ends, those changes disappear.

What you really need to do is modify your login scripts so that those variables are set for you automatically when you login. Assuming this is on an eos machine, simply rename your script to

.mycshrc
Logout and then log back in. Your script should run automatically and you'll be good to go.

Oh, yeah...this script should be in your home directory (e.g. /afs/unity.ncsu.edu/users/w/wyloch/ )

[Edited on February 7, 2007 at 7:11 PM. Reason : ]

2/7/2007 7:09:08 PM

Wyloch
All American
4244 Posts
user info
edit post

That did the trick. Thanks much!

2/7/2007 9:19:16 PM

ruffler
Veteran
108 Posts
user info
edit post

Quote :
"% $SYS
And I get '$SYS: Command not found'"


That should be %echo $SYS

2/7/2007 9:32:49 PM

A Tanzarian
drip drip boom
10994 Posts
user info
edit post

Good catch

2/7/2007 9:35:11 PM

Metricula
Squishie Enthusiast
4040 Posts
user info
edit post

i don't understand. if the program you need is only on a linux machine, why are you forced to use windows?






ZING!!

2/8/2007 1:04:46 AM

joe_schmoe
All American
18758 Posts
user info
edit post

the fact that you're stupid doesn't reflect on the value of Linux one way or another.

2/8/2007 1:46:42 AM

ruffler
Veteran
108 Posts
user info
edit post

Quote :
"i don't understand. if the program you need is only on a linux machine, why are you forced to use windows?
"

Quote :
"
the fact that you're stupid doesn't reflect on the value of Linux one way or another."


haha!

The program appears to be a Sun product. If you hate Linux so much, why don't you use Solaris instead?

2/8/2007 9:39:50 PM

clalias
All American
1580 Posts
user info
edit post

Quote :
"we are forced to use the most worthless operating system on the planet."



just leave that out of your resume.

2/8/2007 9:49:12 PM

Wyloch
All American
4244 Posts
user info
edit post

Quote :
"just leave that out of your resume."


...why would it even be on my resume...? No seriously, I just need some clarification - I assume this was meant as a jab?

Anyways, I just don't see why *nix is so needlessly complicated, but hey, I'm no definitely no CE major. I assume there's reasons (maybe regarding networking or something?) that would lead one to use *nix over Windows. Let's not start the OS debate. Honestly, I'm interested, can someone explain to me what the appeal is? For example, I did learn a little about the Bourne- and c- shells getting this thing to run. Why would you want to have two different command set capabilities as opposed to one master all-inclusive (if I've even understood that correctly)?

2/8/2007 10:20:56 PM

dbtriebe
Veteran
362 Posts
user info
edit post

Hate it? GOOD LUCK

2/8/2007 10:32:46 PM

GonzoBill
Veteran
122 Posts
user info
edit post

Quote :
"Anyways, I just don't see why *nix is so needlessly complicated, but hey, I'm no definitely no CE major. I assume there's reasons (maybe regarding networking or something?) that would lead one to use *nix over Windows. Let's not start the OS debate. Honestly, I'm interested, can someone explain to me what the appeal is? For example, I did learn a little about the Bourne- and c- shells getting this thing to run. Why would you want to have two different command set capabilities as opposed to one master all-inclusive (if I've even understood that correctly)?"


The *nix vs Windows debate really is all about what you want to do with the OS. *nix is simpler in design and implementation, but less intuitive. Windows is plenty intuitive, but is a nightmare of complexity and is less flexible. As to why you would have multiple shells? That's part of the mentality of old-school computing: If you don't like what's already there, write your own. That's why there's craptons of different editors, shells, and even distros.

2/9/2007 12:29:15 AM

Raige
All American
4386 Posts
user info
edit post

I'm a windows advocate, my best friend is a linux guru. There's a lot of pro's and con's and without going into detail...

Linux - more secure, free, "lighter", you can control what's running, what's installed, it's a very configure happy point of view.

Windows - Everything you need is already there or easy to install. It's intuitive design "assuming" you need certain things. It's suitably configurable for most people.

In truth Linux can do everything Windows can do except it takes a lot more time to accomplish things in most situations. But that also depends on what you use your computer for. If you use it for email, web browsing and gaming... linux is not for you. (even with the wine and other emulator programs). It's a time sink to make things work...

It's a timesink. And while it's free, open source and highly configurable that's the double edge sword. It doesn't do anything you don't specifically tell it to do. It's not intuitive at all which is why it's not gone very mainstream. Attempts to make it this way are in Fedora Core, Unbuntu etc. So if you wanted to try one those two would be good. The big thing is people want point and click not command line.

I am a developer. I work with webcode and databases all the time. I cannot stand linux because of it's incompatibility with most of the software I am comfortable using, and when something doesn't work it's never a simple fix.

I think the best description someone ever gave me was that Linux was a manual shifter in a car while Windows is an automatic. Both have their pros and cons and it depends on what the driver wants.

2/9/2007 7:32:31 AM

joe_schmoe
All American
18758 Posts
user info
edit post

i see it as analagous to Standard Ignition (linux) vs. Electronic Ignition (windows). when the Standard Ignition starts running rough, you tweak it. or replace some cheap (actually, free!) parts. when the Electronic Ignition fucks up, youve gotta spend lots of money replacing the whole goddamned thing. '

... but no... that analogy also fails because Windows, unlike electronic ignitions, is neither more efficient, nor more robust.


oh well, i tried

2/9/2007 1:15:57 PM

 Message Boards » Tech Talk » Linux question - csh scripting Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.