我有以下脚本,
#!/bin/ksh
#***********************************************************
echo "Enter Local Drive path LOCALPATH:"
read LOCALPATH
echo "Enter NA R Drive NAPATH:"
read NAPATH![enter image description here][1]
find ./ -type f | xargs sed -i "s|$LOCALPATH|$NAPATH|g" Run.param
#
在单个目录中工作正常&更改Run.param文件的内容
答案 0 :(得分:1)
假设您询问目录NAPATH:
变化
find ./ -type f | xargs sed -i "s|$LOCALPATH|$NAPATH|g" Run.param
到
OUTER = $NAPATH/..
for d in $OUTER/*; do
find ./ -type f | xargs sed -i "s|$LOCALPATH|$d|g" Run.param
done
如果Run.param位于NAPATH中,请使用:
OUTER = $NAPATH/..
for d in $OUTER/*; do
find ./ -type f | xargs sed -i "s|$LOCALPATH|$d|g" $NAPATH/Run.param
done