Jump to content

Niklas

New Member
  • Posts

    2
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    Niklas reacted to deanishe in [SOLVED] Generate custom file names with bash   
    Your mistake is that your date +"%Y%m%d%H%M" command also prints its output. You aren’t actually assigning it to a variable (which is what you seem to want/think is happening).
     
    The correct version of what you're trying is:
    # use var=$( ... ) to assign output of a command to a variable date="$( date +"%Y%m%d%H%M" )" echo -n $date-{query} There’s no need for two commands, however. You can stick it all in one echo statement. And finally, you shouldn’t use {query} (it’s only there for legacy support). Use “with input as argv” instead.

    In that case, your command becomes: echo -n "$( date +%Y%m%d%H%M )-$1"
     
×
×
  • Create New...