bash: comment a long pipeline -


i've found it's quite powerful create long pipelines in bash scripts, main drawback see there doesn't seem way insert comments.

as example, there way add comments script?

#find vnc sessions ls -t $home/.vnc/*.pid                  \     | xargs -n1                         \     | sed 's|\.pid$||; s|^.*\.vnc/||g'  \     | xargs -p50 --replace vncconfig -display {} -get desktop \     | grep "($user)"                    \     | awk '{print $1}'                  \     | xargs -n1 xdpyinfo -display       \     | egrep "^name|dimensions|depths" 

this works too:

# comment here ls -t $home/.vnc/*.pid |  #comment here  xargs -n1 |  #another comment  ... 

based on https://stackoverflow.com/a/5100821/1019205. comes down s/|//;s!\!|!.


Comments

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -