【发布时间】:2016-01-08 09:41:31
【问题描述】:
在另一个脚本中调用函数来删除旧文件 - 需要将 $1 作为字符串传递,而不是该 arg 的 eval(目录中的文件列表)
尝试过: - echo $1 ("$1", '$1') 周围的单引号和双引号 - arg 周围的单引号和双引号 ("/tmp/AB*", '/tmp/AB*')
已在此处阅读了 3 个类似的问题,但未能成功理解该问题...
AIX 6
#!/bin/ksh
#### common load function ######
. /tmp/functions.sh
deletefiles /usr/tmp/AB* 1
#!/bin/sh
# Deletes files from a filelist that are older than X days
deletefiles() {
echo $1
echo $2
#filelist=$1
#days=$2
#execute
#`find ${filelist} -type f -mtime +${days} -exec rm {} + 2>&1`
}
【问题讨论】:
-
你想做什么?所有参数都作为字符串传递。