09-14-2004
Hmmm... You're doing something strage here.
You're grabbing the value for name if $1 is empty. Fine. But then you're
saying if $1 is empty (which it still will be), then set name="", i.e.
lose the value it was just set to?!
Anyway, yes, $1 can be referenced as many times as you want, as long as you're
not trying to reference it inside of a function.
I'd personally save $1 to a variable within the program, i.e. "first_arg=$1" or
whatever.
Cheers
ZB
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
Have one job . first part of it needs to run on five days of the week , while second part of the job needs to run on two days of the week. How do I go abt this?
Thanks (2 Replies)
Discussion started by: cbecentral
2 Replies
2. UNIX for Advanced & Expert Users
Hi all,
I'm running a simulator and I'm noticing an slow increase in memory for long simulations such that the simulation has to end because of a lack of memory. A colleague of mine ran Valgrind memcheck and reported that nothing of interest was reported other than known mem leaks. My advisor... (2 Replies)
Discussion started by: pl4u
2 Replies
3. Shell Programming and Scripting
Hi
I'm running a program many times with differents input.
I mean that i run my_prog with some parameters and i wait till the end, then i start again another simulations with some others differents parameters.
Is possible to make it automatic with a script bash.
Maybe i need some... (2 Replies)
Discussion started by: Dedalus
2 Replies
4. Shell Programming and Scripting
Hi,
First i need to cd to this directory $SWDIR/util
Second i need to run the following either 4 times or 20 times
./swadm add_process 1 BG Y
how can i put this in a script which should ask for user input on how many times you want to run this
Thanks, (5 Replies)
Discussion started by: lookinginfo
5 Replies
5. UNIX for Dummies Questions & Answers
while read s1 ; do
url=
suf=ignore=.csv;
wget $url$s1$suf;
sleep 5;
cat /home/joey/public_html/charts/program/fn\charts/data/tickers/header.txt > $s1.txt;
chmod 777 $s1.txt;
sed '1d' table.csv?s\=$s1 >> /home/joey/public_html/charts/program/charts/data/tickers/$s1.txt;
rm -Rf... (0 Replies)
Discussion started by: harte
0 Replies
6. Programming
Hello,
i'm trying to implement the times() function and i'm programming in C.
I'm using the "struct tms" structure which consists of the fields:
The tms_utime structure member is the CPU time charged for the execution of user instructions of the calling process.
The tms_stime structure... (1 Reply)
Discussion started by: g_p
1 Replies
7. Programming
Hi,
I have a fortran program with serial and MPI version. I want to compare the time taken by these programs to run. I use ifort/gfortran compiler.
How to compare the time taken by each program to run? Is there any sample code for comparison?
Thanks,
rpd (1 Reply)
Discussion started by: rpd25
1 Replies
8. Shell Programming and Scripting
Hi,
I had another question. I was wondering if there was a way to tab a line a variable number of times in tcsh. To go into details, I want to tab a line by how deep a file is in its path.
So here is an example code:
set filea=/blah1/blah2/blah3
set fileb=/blah1/blah2/blah3/blah4
set... (4 Replies)
Discussion started by: chu816
4 Replies
9. UNIX for Dummies Questions & Answers
We have a program source C and is required to indicate how many times each function is called from the C program. also print the line number where there is a call.
I've tried something like this:
#!/bin/sh
for i in $*;do
if !
then
echo $i is not a C file.
else echo $i... (0 Replies)
Discussion started by: oana06
0 Replies
10. Shell Programming and Scripting
Hi all,
I have a big file (n.txt) with following pattern:
ATOM 1 N SER A 1 122.392 152.261 138.190 1.00 0.00 N
ATOM 2 CA SER A 1 122.726 151.241 139.183 1.00 0.00 C
TER
ENDMDL
ATOM 1 N SER A 1 114.207 142.287 135.439 1.00 0.00 ... (3 Replies)
Discussion started by: bioinfo
3 Replies
LEARN ABOUT REDHAT
tixutils
Utils(n) Tix Built-In Commands Utils(n)
__________________________________________________________________________________________________________________________________________________
NAME
tixUtils - Utility commands in Tix.
SYNOPSIS
tixDescendants pathName
tixDisableAll pathName
tixEnableAll pathName
tixPushGrab ?-global? window
tixPopGrab
_________________________________________________________________
DESCRIPTION
tixDescendants pathName
Returns a list of all the descendant widgets of pathName plus pathName itself.
tixDisableAll pathName
Disables pathName and all its descendants.
tixEnableAll pathName
Enables pathName and all its descendants.
tixPushGrab ?-global? window
The tixPushGrab and tixPopGrab commands allows you to perform "cascade-grabbing". tixPushGrab calls the grab(n) command on window
and saves window on a grabbing stack.
tixPopGrab
tixPopGrab pops the top-most element from the grabbing stack and release its grab. If the grabbing stack is not empty, then tixPop-
Grab will execute grab(n) on the current top-most element in the grabbing stack.
NOTES
Some Tix widgets (for example, tixComboBox and tixPanedWindow) grabs the screen on certain occasions using tixPushGrab and tixPopGrab.
Therefore, if you need to grab the screen when these widgets are present, you should also call tixPushGrab and tixPopGrab in place of the
Tk grab and grab release commands. Otherwise, the behavior of these widgets may be undefined.
KEYWORDS
Tix(n), grab(n)
Tix 4.0 Utils(n)