0
localhost:~ $ df -k / | awk '{print $3/1024/1024/1024}'
0
0.00618061

localhost:~ $ ssh localhost "df -k / | awk '{print $3/1024/1024/1024}'"
01
01
Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
phar1no
  • 31
  • 4

1 Answers1

2

You need more quoting when you pass arguments to SSH. Try this:

ssh localhost "df -k / | awk '{print \$3/1024/1024/1024}'"
0
0.00623375

Note the \ before $3.

sebix
  • 439
  • 6
  • 14
mattcen
  • 36
  • 1