2
0

More than 5 years have passed since last update.

fishでファイルを連番つきコピーで複製する。にはforループ

Posted at

コード

for i in (seq 10)
    cp target.txt target$i.txt
end

やりたいこと

ディレクトリにあるtarget.txtをn個コピーして同一フォルダに設置したい。

できない

linux - Copy a range of files in command line (ZSH/BASH) - Server Fault

のようにワンライナーでしたかったけどできなかった。
bashでこのコードを動かしてもできず、よくよく読むとすでにあるファイルを別ディレクトリへのコピーだった…

bashでもforループに頼りそう


seqxargsを使ったワンライナーが出来ないか考えたものの、スキル不足で断念。


このコードだけでは0パディングできず、自然順ソートしない環境で見にくいのであまりよくない。

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0