【发布时间】:2014-01-02 18:02:11
【问题描述】:
我在没有传递参数的情况下从 script1.sh 调用 script2.sh。但我将参数传递给 script1.sh。我正在尝试打印 script2.sh 的第一个参数。
script1.sh
#! /bin/bash
PRM1=$1
source script2.sh
script2.sh
#! /bin/bash
PRM1=$1
echo "$PRM1"
输出是
# source script1.sh hello
#hello
#
但理想情况下
# source script1.sh hello
#
谁能告诉我为什么 script2.sh 将 script1.sh 参数作为参数?
【问题讨论】:
标签: linux bash shell unix parameters