Bash scripts not working
I have used few bash script in my centos 6.4 server which is working fine.
but its not executing properly in cloudlinux kernel. Bash version is different on both server. example working fine in centos 6 qt=$(quota -v $user | grep -v quotas | grep -v blocks | awk '{total+=$2} END {print total/1024}') But this is not working in cloudlinux. |
Quote:
- error messages? - no output? - unexpected output? I don't see anything wrong with the command shown. It could be done simpler/more elegant, but that's not the issue at hand. |
Thanks for your reply... I received unexpected output..
This once is correct quota -v $user | grep -v quotas | grep -v blocks | awk '{total+=$2} END {print total/1024}' user1 78|| user2 23|| But same command does not fetch user quota here quota -v $user | grep -v quotas | grep -v blocks | awk '{total+=$2} END {print total/1024}' user1 1000|| user2 1000|| |
just execute the command quota and check if it has the same output format.
Do not use grep|grep|awk chain or similar, it can be implemented in one: Code:
quota -v $user | awk '/quotas/{next}/blocks/{next}{total+=$2} END {print total/1024}' |
All times are GMT -5. The time now is 11:57 AM. |