Indenting multi-line output in a shell script

前端 未结 3 812
陌清茗
陌清茗 2021-01-30 19:28

I\'m trying to change the message of the day (MOTD) on my Ubuntu Amazon EC2 box so that it will display the git status of one of my directories when I SSH in.

The output

3条回答
  •  醉酒成梦
    2021-01-30 20:09

    Pipe it to sed to insert 2 spaces at the beginning of each line.

    git status | sed 's/^/  /'
    

提交回复
热议问题