I want to get size of file into variable ? How to do that?
ls -l | grep testing.txt | cut -f6 -d\' \'
gave the size but how to store it in
size() { file="$1" if [ -b "$file" ]; then /sbin/blockdev --getsize64 "$file" else wc -c < "$file" # Handles pseudo files like /proc/cpuinfo # stat --format %s "$file" # find "$file" -printf '%s\n' # du -b "$file" | cut -f1 fi } fs=$(size testing.txt)