I want to create a shell script
df. As, I want to type in
df name_of_file and then I can get the contents of the file.
If the file name is in the directory, I want it to show its contents. If not, I want to show the size in words, lines, and bytes. How do I go about this? So far, I have this:
#!/bin/bash FILENAME=$FILENAME FILEBYTES=$(stat -c%s "$FILENAME") FILEWORDS=$(stat -w%s "$FILENAME") FILELINES=$(stat -l%s "$FILENAME") echo "Size of $FILENAME in bytes = $FILEBYTES bytes, $FILEWORDS words, $FILELINES lines."