Results 1 to 2 of 2
Hi friends,
The method of "alias " is GREAT.
I have tried to make a custom command to know file size in MB
I tried this
Code:
alias lsmb='ls -l ...
- 09-07-2009 #1Just Joined!
- Join Date
- Sep 2009
- Posts
- 1
alias error
Hi friends,
The method of "alias " is GREAT.
I have tried to make a custom command to know file size in MB
I tried this
and when I didCode:alias lsmb='ls -l | awk '{printf "%s %i %s %s %.3fMB %s %i %s %s\n", $1,$2,$3,$4,$5/1024000,$6,$7,$8,$9}' 'it shows me errorCode:source .bashrc
I guess the error is due to the awk and single quotesCode:bash: alias: %s %i %s %s %.3fMB %s %i %s %s\n,: not found bash: alias: ,,,,/1024000,,,,}: not found

Any idea how to do it ??
- 09-09-2009 #2Here I replaced the outer quotation marks in to double marks " which works well in HTML (haven't tried here, but I hope it is similar)Code:
alias lsmb="ls -l | awk '{printf "%s %i %s %s %.3fMB %s %i %s %s\n", $1,$2,$3,$4,$5/1024000,$6,$7,$8,$9}' "
Here is the \ in front of the quotation mark saying it shouldn't end the string there, but include the quotation mark into the string.Code:alias lsmb='ls -l | awk\ '{printf "%s %i %s %s %.3fMB %s %i %s %s\n", $1,$2,$3,$4,$5/1024000,$6,$7,$8,$9}\' '
Hope either of them work, as I haven't tested it.


Reply With Quote