Hilshire / blog

temporary blog
2 stars 0 forks source link

sh脚本 执行命令并输出结果 #20

Closed Hilshire closed 5 years ago

Hilshire commented 5 years ago

不会写sh脚本,网上抄一段记录一下防止以后用到想不起来

#!/bin/bash
#function to display commands
exe() { echo "\$ $@" ; "$@" ; }

exe echo hello world
$ echo hello world
hello world

How to echo shell commands as they are executed