03-06-2008
How to clear $1 when dot-running a script.
Here's my problem: the $1 parameter is getting permanently set when you dot-run a script - and I cannot unset it.
Here's how to duplicate the problem:
1) Create a script called testme and put this simple command in the script:
echo 1=$1
Save the script
2) Make the testme script executable
chmod a+rx testme
3) Now dot-run the script:
. testme
Output:
1=
4)Now dot-run the script with a parameter:
. testme YOU
Output:
1=YOU
5) Now dot-run the script without a parameter:
. testme
Output:
1=YOU
HUH??? There's the problem!!! Why did the script remember the $1 parameter value?
The question is - how do I clear that $1 value???
edit by bakunin: while this is a very interesting question it is hardly related to AIX. I move it over to "Shell programming and scripting" therefore.
Last edited by bakunin; 03-06-2008 at 05:36 AM..
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello. I should have asked this awhile ago but here is my situation. My task is to generate LOC for different directories. I have a text file that has dates in this format (01-Aug-2006). My task is to read each line and compare it to a branch date. Depending on the date, it should generate a... (0 Replies)
Discussion started by: mastachef
0 Replies
2. Linux
I have a log file on our system which fills up with lines that have been timestamped, as follows....
03/03/2008 10:56:06:815] (ERROR) balance: continuing session to genapp02 : 18500
03/03/2008 10:56:06:820] (ERROR) balance: continuing session to genapp02 : 18500
03/03/2008 10:56:07:003]... (2 Replies)
Discussion started by: davesimm
2 Replies
3. Solaris
Hi,
i have a script which need to do behave differently when run as a startup process from init.d/ rc2.d script and when run manually from shell.
How do i distinguish whether my script is run by init process or by shell??
Will the command
/proc/$$/psinfo | grep "myscript" work well???... (2 Replies)
Discussion started by: vickylife
2 Replies
4. SCO
OS SCO Open Server 6.0 MP4
I am trying to change the value of a enviornment variable thru a script and want to pass a parameter on the commande line, If I hard code the value inside the script the script changes the enviornment variable
. mytest
where my test is
MYVAR=$1
export MYVAR... (6 Replies)
Discussion started by: atish0
6 Replies
5. AIX
Good day UNIX forum, could you help me with my clear printer queue script, i have problems with the consistency of this function, sometimes it works sometimes it doesn't. Thanks in advance
}
preRemovePrintQ(){
clear;
echo;
echo... (1 Reply)
Discussion started by: beware187
1 Replies
6. Shell Programming and Scripting
I am new to Shell Scripting and need some help.
The following batch job has been failing for me due to the .nfsxxx files in use. I need to know how to modify the following script to exclude the .nfsxxx files so this batch job will not fail on me. I have done lots of googling and keep coming back... (2 Replies)
Discussion started by: kimberlyg2007
2 Replies
7. Shell Programming and Scripting
I am using blow script :--
#!/bin/bash
FIND=$(ps -elf | grep "snmp_trap.sh" | grep -v grep) #check snmp_trap.sh is running or not
if
then
# echo "process found"
exit 0;
else
echo "process not found"
exec /home/Ketan_r /snmp_trap.sh 2>&1 & disown -h ... (1 Reply)
Discussion started by: ketanraut
1 Replies
8. Shell Programming and Scripting
Hi,
I have a script which does couple of database connection and run some SELECT queries to get some output in the file.
I am surprised to see :eek: that when i run my script some times it gives the desired out put and sometimes it shows some error :confused: .
Suppose if i execute it say... (3 Replies)
Discussion started by: Sharma331
3 Replies
9. HP-UX
Hi,
I have created a script to clear up the /var filesystem once it reaches > 90%.
This is part of the script :
#!/bin/bash
DIR = ./adm
DIR2=./adm/sw
DIR3 = ./spool/mqueue
DIR4 = ./adm/syslog
DIR5 = ./adm/sulog
DIR6 = ./tmp
F1 = ./tmp/dead.letter
F2 = ./adm/wtmps
file1 =... (5 Replies)
Discussion started by: anaigini45
5 Replies
LEARN ABOUT SUSE
avahi-autoipd.action
avahi-autoipd.action(8) System Manager's Manual avahi-autoipd.action(8)
NAME
avahi-autoipd.action - avahi-autoipd action script
SYNOPSIS
/etc/avahi/avahi-autoipd.action
DESCRIPTION
avahi-autoipd.action is the action script that is called whenever an IP address has been acquired by avahi-autoipd or when it detected an
IP address conflict. The script should add or remove the specified address from the specified network interface.
PARAMETERS
argv[1] An event string: one of BIND, CONFLICT, UNBIND or STOP. If BIND is passed an IP address has been sucessfully acquired and the
script shall add it to the network interface. If CONFLICT is passed avahi-autopid detected a IP address on the local network, the action
script should remove the configured IP address. If UNBIND is passed the IP address should be removed from the interface, too, because a
routable address has been configured to the interface by some other program. If STOP is passed the avahi-autoipd is being shutdown and the
action script should remove the IP address. In short: on BIND the address should be added to the interface, on CONFLICT, UNBIND or STOP it
should be removed.
argv[2] The network interface name.
argv[3] An IP address from the IPv4LL range.
AUTHORS
The Avahi Developers <avahi (at) lists (dot) freedesktop (dot) org>; Avahi is available from http://avahi.org/
SEE ALSO
avahi-autoipd(8), dhclient-script(8), ip(8), ifconfig(8)
COMMENTS
This man page was written using xml2man(1) by Oliver Kurth.
Manuals User avahi-autoipd.action(8)