代码:

#!/bin/bash

ls=$(ls)
echo $ls

whoami=`whoami`
echo $whoami

执行结果:

[os-××××××××101z ~]$ sh cmd2.sh
1.py 2020-03-16-b020 AllocationReq_0030_20200306142925.csv AllocationReq_0104_20200310145723.csv AllocationReq_0104_20200310145723.end clean.py cmd2.sh hname.sh mkdirs.py test.txt webclean.sh work.nfs
os-hy01

--2020-03-18--