logoISU  

CS469/569 - Linux and Unix Administration and Networking

Spring 2022

Displaying ./code/02-03-Bash_Conditionals_and_Loops/if.sh

#!/bin/bash

file=${1:-.}

if [[ -h $file ]]; then
  echo "Symbolic link";
elif [[ -d $file ]]; then
  echo "Directory";
elif [[ -c $file ]]; then
  echo "Character special";
elif [[ -b $file ]]; then
  echo "Block special";
elif [[ -p $file ]]; then
  echo "Named pipe";
else
  echo "Regular file";
fi