如何在 Exec 资源类型中执行 bash 命令行?
How can I execute bash command line in Exec resource type?
我有这个 Exec 声明:
exec { 'Normalize MP3 filename':
environment => ["t=0"],
command => 'for i in *mp3; do mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
cwd => "$resource_path/res/raw",
} ->
当我的清单运行时出现此错误:
Error: Could not find command 'for'
Error: /Stage[main]/Make_it::App_mp3files/Exec[Normalize MP3 filename]/returns: change from notrun to 0 failed: Could not find command 'for'
*nix 操作系统上的默认 exec 提供程序是 posix
,即 does not support shell built-ins such as for
。您应该将提供程序更改为 shell
以使用 shell 内置函数。
exec { 'Normalize MP3 filename':
environment => ["t=0"],
command => 'for i in *mp3; do mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
cwd => "$resource_path/res/raw",
provider => 'shell',
} ->
我有这个 Exec 声明:
exec { 'Normalize MP3 filename':
environment => ["t=0"],
command => 'for i in *mp3; do mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
cwd => "$resource_path/res/raw",
} ->
当我的清单运行时出现此错误:
Error: Could not find command 'for'
Error: /Stage[main]/Make_it::App_mp3files/Exec[Normalize MP3 filename]/returns: change from notrun to 0 failed: Could not find command 'for'
*nix 操作系统上的默认 exec 提供程序是 posix
,即 does not support shell built-ins such as for
。您应该将提供程序更改为 shell
以使用 shell 内置函数。
exec { 'Normalize MP3 filename':
environment => ["t=0"],
command => 'for i in *mp3; do mv -v $i track_`seq -f "%03g" $t $t`.mp3 ; t=`expr $t + 1`; done',
cwd => "$resource_path/res/raw",
provider => 'shell',
} ->