Get last line of shell output as a variable

后端 未结 2 1991
走了就别回头了
走了就别回头了 2020-12-29 04:01

I am working on a shell script with exiftool to automatically change some exif tags on pictures contained in a certain folder and I would like to use the output to get a not

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 04:45

    Put the tail inside the capturing parens.

    OUTPUT=$(exif ... | tail -1)
    

    You don't need the double quotes here. I'm guessing that you tried

    OUTPUT="$(exif ...) | tail -1"
    

提交回复
热议问题