[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATH and $0
From: |
Cai Qian |
Subject: |
PATH and $0 |
Date: |
Tue, 11 Jul 2006 15:49:31 +0100 |
Hi,
What is the expected result of the following script?
#! /bin/bash -
export PATH=/tmp/
echo $0
exit 0
Then, put this file to /tmp/.
cd / and run
PATH=/tmp/ script.sh
In some Linux, it will print "/tmp/script.sh", while in other, it will
print "script.sh" only. Which is wrong? If both are fine, is there any
better way to make it portable?
Qian