我是 shell 脚本的新手,我想将字符串 export var
var=$othervar # Safe in all shells, with or without quotes
local var2
var2=$(somecommand) # also safe, with or without quotes
的最后一个字符更新为下一个字母并循环遍历提供的计数,然后使用 shell 脚本将其写入文件。有人可以帮我吗?
例如:如果 Count 为 10,那么我想循环 10 次以更新字符串并在文件的下一行中写入更新后的字符串。
示例文件:myfile.txt
/dev/sda
答案 0 :(得分:1)
产生所有的可能性,只选择你想要的。
printf '%s\n' /dev/sd{a..z} | head -n"$count"