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

时间:2021-05-03 20:20:01

标签: shell scripting

我希望有人能告诉我如何扩展从文件中读取的变量 ($ORACLE_PATCH_DIR)。

代码如下。

输入文件:

cat patch_list_db.txt
$ORACLE_PATCH_DIR/32579100/32518631/31704029

Korn 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"

结果:

./apply_db_patch.ksh patch_list_db.txt
Oracle Patch Dir:  /u2/patches
16:14:34 ===> DIR_NAME: $ORACLE_PATCH_DIR/32579100/32518631/31704029

提前致谢。

0 个答案:

没有答案