csh

Running "source" from python

Hello, I have a file a.txt with lines of commands I want to run, say: echo 1 echo 2 echo 3 If I was on csh (unix), I would have done source a.txt and it would run. From python I want to run os.execl with it, however I get: >>> os.execl("source", "a.txt") Traceback (most recent call last): File "<stdin>", line 1, in <module> File...

Dont want my cshrc to execute on login

Hi, On unix I am working as say user X, and I want to login to user Y from X. Now issue is that I dont want Y's cshrc (or any other login script) to run while I login to his user name. I vaguely remember there used to be a way to do so, something like execute "su" command with some option for not running login scripts, but none of th...

How do I escape a field variable in an awk command in an alias?

Here are the contents of a file: one two three four five six And here is my alias alias testawk "awk '{print $2}' file" This is what I get: > testawk one two three four five six But when I give this command, then I get what I want: > awk '{print $2}' file two five How do I escape the field specifier in the alias? NOTE: I'm us...

Overcoming os.system() limitation in Python 2.3

I am having a problem converting one of my company's scripts from csh to Python. The csh script calls an aliased command, but when I call that same aliased command via os.system(), it does not work. So, if foo is the aliased command: CSH Script (this works, executes foo): foo <argument> Python (this does not work, error claims foo ...

Output of last shell command

In a linux shell, is it possible to return the output of the last command. I realize I could have piped it or sent the output to a file, but my requirement is to retrieve that output after the command has been run. Using csh, but would hear about any shell. Edit For some context: Not until midway through a 3 hour build script, I'll re...

cshell tab completion , case insensitive

for C Shell is there a way to make tab completion for commands, files etc as case insensitive (i saw complete=enhance env var, but that is only for tcsh, not csh) ...

How to determine the current shell i'm working on ?

How to determine the current shell i am working on ? Does ps command output will alone do ? How to do this in different flavors of UNIX ? ...

Edit shell script while it's running

Can you edit a shell script while it's running and have the changes affect the running script? I'm curious about the specific case of a csh script I have that batch runs a bunch of different build flavors and runs all night. If something occurs to me mid operation, I'd like to go in and add additional commands, or comment out un-execut...

Why is the executable not identified even though the containing directory is on the search path?

I have a /usr/sbin on my search path (echo $PATH). I have my lsof executable in this directory. Why do I get lsof: command not found if I just type lsof on the prompt. I am using csh. ...

How to determine current remote connection type? (rsh or ssh)

Hi all, I want to know if there is some methods to find out the current connection type to remote server (rsh or ssh?). Environment is Solaris 9, SuSE linux, csh. ...

Csh alias with perl one-liner evaluates when alias is created and not when alias is used

I know, I know, I should use a modern shell... Anyway, so here is the alias: alias p4client echo `p4 info | perl -ne 's/Client name: (.*)$/print $1/e'` I also know there is probably a better way to get the p4 client name. This is just an example. So, can anyone tell me a nice and clean way to get this to evaluate this when I invoke...

Whats wrong with this C shell script?

I am trying to write a C shell equivalent script for the bash script mentioned here. This is what I have : #! /bin/tcsh set now=`date +%Y%m%d%H%M.%S` if (( ! -f "./cache" ) || (-n "`find ./monme -newer ./cache`" )) then touch cache -t "$now" echo "new files added" | mail -s "new build" [email protected] endif and this i...

csh scripting for password authorisation of user

I'm trying to write a professional program to accept and process input via a Menu based system. The program should have no command line arguments. it will be writen in csh script called TaskMenu. This shell script will: 1) ask for a password from the user. If the password is not correct, the system will exit with an appropriate...

Do we have short circuit logical operators in C shell script?

I thought C shell script will behave like C and use short circuit evaluation for logical operators. if ((! -e $cache ) || ("`find $monitor -newer $cache`" != "")) then ... endif But in the if statement, even if the first condition is true, the second is checked giving me errors. Do we have a short circuit logical OR in C shell script...

Csh run script config file, and variables.

I am fairly inexperienced with shell(csh in this case) scripts but was asked to edit one. I was asked to add a config file to make it much simpler to edit several specific variables. I thought this was silly because this is a script and reading to and from a file would be a little silly so I though I could just make a different script th...

Multiple wordlists in csh script foreach loop

I have a Cshell script that I am modifying to have related input and output locations. the functionality all happens in a foreach loop like so: set INPUT_LOCATION_LIST = "loc1 loc2 loc3 loc4" foreach location ($INPUT_LOCATION_LIST) #***Do some stuff *** end I would like to have an output list with different values than the input list...

How do I recover STDIN from a perl script that was called from a csh script?

I have a terrible nested script structure I am maintaining that takes user input from the keyboard periodically and I am trying to write a script that will automate this input. Essentially, the script structure looks like this: cmd1.csh takes 3 lines of input and then calls cmd2.csh, then exits normally cmd2.csh calls cmd3.pl twice an...

Declaring User Defined Variable in Shell Scripting (csh shell)

I am trying to learn shell scripting and trying to create a user defined variable within the script, first: howdy="Hello $USER !" echo $howdy However, when I execute the script (./first) I get this: howdy=Hello aaron!: Command not found. howdy: Undefined variable. What am I doing wrong? ...

Set default user variable in csh scripting

I am writing a csh shell script, run where the user is expected to pass a path into it as the $1 variable. How can I determine if $1 is missing and define a default value instead for it? ...

How to change shells in script

The default shell on the the system is csh but I want to write a script in bash. How do I write a script that will run bash and then convert back to csh at the end. I tried this but it doesn't work: bash var=Hello echo $var csh ...