question about bash command
I have to questions about this function I found on a script
Code:
function FILESIZE ( ) Code:
FN=${1:-/dev/null} second: Code:
set -- $(ls -s "$FN") |
No, it means that set FN to $1 and if $1 isn't passed then set FN TO /dev/null
|
You can get file size using
Code:
stat -c '%s' file |
Quote:
|
Yes you were correct on the first point (and yes I see no difference with yours and first reply)
As to the set command, there are actually 2 questions: 1. What does -- do? Answer, for some commands, set being one, -- means that anything received after this will be an argument to the set command. This means that if after -- you should receive something like '-a', which may normally be an a switch for set, that it should now be treated as an argument, example: Code:
$ set -- -a Code:
$ touch 'this is my file' |
All times are GMT -5. The time now is 07:05 PM. |