bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Functions


From: Balachandar
Subject: Functions
Date: 09 May 2002 12:43:20 +0530

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' -DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H  -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/include -O2 -march=i386 -mcpu=i686
uname output: Linux bala 2.4.2-2 #1 Sun Apr 8 20:41:30 EDT 2001 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.04
Patch Level: 21
Release Status: release

Description:
[Detailed description of the problem, suggestion, or complaint.]

Problem in shell functions
I have the following in a script.

                 #!/bin/bash
                 func() {
                     echo $1
                 }
                   func $1

The entire path of the above script is /home/user/bin/nothing, where 'nothing' is the script file name. "/home/user/bin" is in the PATH
Now I have appended the following line to my .bashrc file in '/home/user' directory.

                 . /home/user/bin/nothing 3

    After getting into the bash shell, I typed "/home/user/bin/nothing" without any parameter. The output I got is

                             3
                             3

    why is it printing 3 the second time, though I haven't given any parameter


Repeat-By:
[Describe the sequence of events that causes the problem
to occur.]

Fix:
[Description of how to fix the problem.  If you don't know a
fix for the problem, don't include this section.]

reply via email to

[Prev in Thread] Current Thread [Next in Thread]