So I have .csh script generate.csh
I want to call another .csh script from within it.
I tried
./shell_gen.csh test1 test2.prt
But it runs shell_gen.csh but without command line arguments.
Anyone?
Thanks
generate.csh
#!/bin/csh
./shell_gen.csh test1 test2.prt
shell_gen.csh
#!/bin/csh
set source = output
########################...
Say I want to iterate from letter A to letter Z in csh shell. How do I succinctly do that?
In bash I would do something like
for i in 'A B C ...Z'; do echo $i; done
The point is I don't want to write A through Z, I want something like
[A-Z]
Can you suggest a one line suggestion in AWK or Perl?
...
I wanted to know why i am seeing a different behaviour in the background process in Bash shell
Case 1: Logged in to Unix server using Putty(SSH)
By default it uses csh shell
I changed to bash shell
typed sleep 2000 &
press enter
It gave me the job number. Now i killed my session by clicking the x in the putty window
Now open anothe...
I have a million of alias stored in my .cshrs file. I wonder if it is preferred way or people use other files to do it and then loaded into the environment.
How do you do it?
...
How to extract filename from the path; i have a list of files. I'm using csh shell, and have awk, sed, perl installed.
/dfgfd/dfgdfg/filename
should give me
filename
I tried basename:
find $PROJDIR -name '*.c' -o -name '*.cc' -o -name '*.h'
| xargs grep -l pattern | xargs basename
and it gave me the following error:
basen...
Hi,
In bourne-compatible shells, the { list; } syntax causes the complete list of commands to be read by the shell before executing it, without opening a new shell. Is there anything similar for the csh?
Thanks.
...
coming from bash shell, I missed on an easy rolling of loops (for i in (...); do ... done;)
Would you post typical one-liners of loops in cshell?
ONE LINERS PLEASE, and not multiple-lines
thx
...
Hey,
I have a short text file with the following syntax:
FileName: some name
Version: 3
Length: 45
hello, this is an irrelevant, unimportant text.
So is this line.
Now, I'm trying to write a script that replace the version number with a given new number.
Anyone knows how to? I really don't mind it to be ugly
thanks,
Udi
...
I have a config file that contains the following line:
pre_args='$REGION','xyz',3
Using perl from within a csh script I can evaluate environment variable $REGION like so:
set pre_args = `grep -v '^#' $config_file | grep pre_args | cut -f 2 -d = | sed 's/ //g'`
if ("$pre_args" != "") then
set pre_args = `echo $pre_args | perl -ne '...
I'm new to shell scripting, right now using csh and let's say I have a line in my configuration file like this:
127.0.0.1:2222 127.0.0.2:3333 127.0.0.3:4444
All I want is to parse it for two variables in array :
2222 3333 4444
And another one
127.0.0.1 127.0.0.2 127.0.0.3
...
For the following script
install.csh:
#!/bin/csh -f
tar -zxf Python-3.1.1.tgz
cd Python-3.1.1
./configure
make
make install
cd ..
rm -rf Python-3.1.1
Intended use:
./install.csh |& tee install.log
How can I change the script so that I still get a install.log and the output on console without asking the user to do the redirecting...
Write Script to read a positive integer number then it computes the following sequence:
If the number is even, halve it
If it is odd multiply it by 3 and add1
You should repeat this process until the value is 1, printing out each value and how many of these operations you performed.
#! bin\csh
echo "please enter any integer number :) ...
The Perl manual describes a totally devious construct that will work under any of csh, sh, or Perl, such as the following:
eval '(exit $?0)' && eval 'exec perl -wS $0 ${1+"$@"}'
& eval 'exec /usr/bin/perl -wS $0 $argv:q'
if $running_under_some_shell;
Devious indeed... can someone please explain in detail how this works?
...
Hi all,
I'm trying to call a script in Tcl with the command:
exec source <script path>
and I get the error
couldn't execute "source": no such file or directory
How can I call another script from tcl?
Edit: I am running a command I got from another person in my office. I was instructed to run "source " explicitly with source. So i...
What does an ampersand at the beginning of a line do in csh? It seems to be ignored (with no error message), but why?
...
I just came to know that .sh files don't use set and spaces around = are not allowed, while this is allowed in a .csh file.
Is there some place that you can point me to where I can find all these minor differences?
...
I've got a few csh scripts where I need to check that certain environment variables are set before I start doing stuff, so I do this sort of thing:
if ! $?STATE then
echo "Need to set STATE"
exit 1
endif
if ! $?DEST then
echo "Need to set DEST"
exit 1
endif
which is a lot of typing. Is there a more elegant idiom for c...
For example suppose I do a certain man or maybe a grep.
I want to see the results using gvim without the normal procedure of saving them first and opening the saved file [because I don't need the results once I view them]
I tried two ways, both the methods fail:
a)
man gcc | gvim
//opens a blank gvim window
b)
man gcc > gvim
//sa...
I found an odd problem when I run a simple csh script on Solaris.
#!/bin/csh
echo $LD_LIBRARY_PATH
Let's call this script test. When I run this:
shell> echo $LD_LIBRARY_PATH
shell> /usr/lib:/usr/openwin/lib:/usr/dt/lib:/usr/local/lib:/lib:/my_app/lib
shell> ./test
shell> /usr/lib:/usr/openwin/lib:/usr/dt/lib:/usr/local/lib:/lib
The...
How do you get the last day of the last month in csh?
Here is the code so far. The cal command below almost works if you execute it from the (FreeBSD sh) command line, but I'm having trouble escaping it properly to run within a script. By almost work, I mean it returns 31, when the last day of February 2010 is 28.
#!/bin/csh
set last...