如何使用ksh脚本展开从文本文件读取的shell变量

如何使用ksh脚本展开从文本文件读取的shell变量,shell,scripting,Shell,Scripting,我希望有人能告诉我如何扩展从文件中读取的变量($ORACLE\u PATCH\u DIR) 代码如下 输入文件: cat patch_list_db.txt $ORACLE_PATCH_DIR/32579100/32518631/31704029 科恩Shell脚本 # Read one patch location at a time from the patch_list_db.txt file and apply the patch while read DIR_NAME do st

我希望有人能告诉我如何扩展从文件中读取的变量($ORACLE\u PATCH\u DIR)

代码如下

输入文件:

cat patch_list_db.txt
$ORACLE_PATCH_DIR/32579100/32518631/31704029
科恩Shell脚本

# Read one patch location at a time from the patch_list_db.txt file and apply the patch
while read DIR_NAME
do
  str="DIR_NAME: $DIR_NAME"
  print_function "$str"

  cd $DIR_NAME
  ls

  str="Current Dir: `pwd`"
  print_function "$str"

done <"$file_name"

提前感谢。

请展示您的
print_函数
和其他相关部分,尝试
echo“${!DIR_NAME}”
完整的代码如下。print_函数(){date_str=$(date+%H:%M:%S)print_str==>“$1 echo$print_str}”
./apply_db_patch.ksh patch_list_db.txt
Oracle Patch Dir:  /u2/patches
16:14:34 ===> DIR_NAME: $ORACLE_PATCH_DIR/32579100/32518631/31704029