我的这个目录充满了图像,我可以这样做:
echo *.jpg
image1.jpg image2.jpg image3.jpg # and so on
如何获得这种格式的纯文本文件的输出?
image1.jpg
image2.jpg
image3.jpg
ベストアンサー1
避免使用ls
bash glob 可以做得更好
printf '%s\n' *.jpg >output_file
我的这个目录充满了图像,我可以这样做:
echo *.jpg
image1.jpg image2.jpg image3.jpg # and so on
如何获得这种格式的纯文本文件的输出?
image1.jpg
image2.jpg
image3.jpg
避免使用ls
bash glob 可以做得更好
printf '%s\n' *.jpg >output_file