gpt4 book ai didi

shell 脚本: Read line in file

转载 作者:行者123 更新时间:2023-12-04 16:17:52 25 4
gpt4 key购买 nike

我有一个文件paths.txt:

/my/path/Origin/.:your/path/Destiny/.
/my/path/Origin2/.:your/path/Destiny2/.
/...
/...

我需要一个脚本CopyPaste.sh,使用文件paths.txt将OriginX中的所有文件复制到DestinyX

类似的事情:

 #!/bin/sh

while read line
do
var= $line | cut --d=":" -f1
car= $line | cut --d=":" -f2
cp -r var car

done < "paths.txt"

最佳答案

使用翻译:tr命令并在同一个go中应用cp命令!

#!/bin/sh

while read line; do
cp `echo $line | tr ':' ' '`
done < "paths.txt"

关于 shell 脚本: Read line in file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21478334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com