#!/bin/bash
# 脚本名称:myfirstshell
echo hello `hostname`
ls -a ..
echo $PATH
echo $HOME
df -h
id -g `hostname`
echo goodbye
#!/bin/bash
etc=(`ls /etc`)
echo ${#etc[*]}
var=(`ls /var`)
echo ${#var[*]}
usr=(`ls /usr`)
echo ${#usr[*]}
#!/bin/bash
name=`whoami`
echo "用户名=$name"
userid=`id -u`
echo "uid=$userid"
echo "pwd=`pwd`"
#!/bin/bash
pflie=(`ls /etc |grep -i "^p"`)
echo "p或P开头的文件个数为${#pflie[*]}"
#!/bin/bash
read -p "请输入一个文件名" file
if [ -f $file ]
then
echo "是普通文件"
else
echo "不是普通文件"
fi