Skip to main content
added 207 characters in body
Source Link
dave_thompson_085
  • 4.7k
  • 1
  • 20
  • 17

An alternative to getting the somewhat complicated quote-escaping right:

 alias botlogs='ssh user@host "ls -r ~/whatever/*log | head -1 | xargs tail -f"'
 # if (selected) filename contains backslash or quotemark(s) 
 # need -d'\n' on GNU and I don't know good solution on other
 # this also fails if filename contains whitespace, but so did $( )

although I concur that the function should work without any hackery and in general functions are more consistent and flexible and just plain better than aliases.

And PS: when ls output is piped (or redirected) it always uses 1-column format, you don't need -1 here.

An alternative to getting the somewhat complicated quote-escaping right:

 alias botlogs='ssh user@host "ls -r ~/whatever/*log | head -1 | xargs tail -f"'

although I concur that the function should work without any hackery and in general functions are more consistent and flexible and just plain better than aliases.

And PS: when ls output is piped (or redirected) it always uses 1-column format, you don't need -1 here.

An alternative to getting the somewhat complicated quote-escaping right:

 alias botlogs='ssh user@host "ls -r ~/whatever/*log | head -1 | xargs tail -f"'
 # if (selected) filename contains backslash or quotemark(s) 
 # need -d'\n' on GNU and I don't know good solution on other
 # this also fails if filename contains whitespace, but so did $( )

although I concur that the function should work without any hackery and in general functions are more consistent and flexible and just plain better than aliases.

And PS: when ls output is piped (or redirected) it always uses 1-column format, you don't need -1 here.

Source Link
dave_thompson_085
  • 4.7k
  • 1
  • 20
  • 17

An alternative to getting the somewhat complicated quote-escaping right:

 alias botlogs='ssh user@host "ls -r ~/whatever/*log | head -1 | xargs tail -f"'

although I concur that the function should work without any hackery and in general functions are more consistent and flexible and just plain better than aliases.

And PS: when ls output is piped (or redirected) it always uses 1-column format, you don't need -1 here.