16 lines
264 B
Bash
Executable file
16 lines
264 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Checking if the user provided a file name
|
|
if [ $# -ne 1 ]; then
|
|
echo "Usage: $0 filename"
|
|
exit 1
|
|
fi
|
|
|
|
# Checking if the given file is readable
|
|
if ! [ -r "$1" ]; then
|
|
echo "The file '$1' is not readable or does not exist."
|
|
exit 1
|
|
fi
|
|
|
|
sort $1
|
|
|