0

I have an alias file with the following line: alias ss="import /home/User/Pictures/screenshots/screenshot-$( date '+%Y-%m-%d-%H-%M-%S.png' )"

In terminal, when I type "ss" it runs the command and saves correctly. However, if I run it again, the date does not update. Am I missing something?

2

The problem is that the date command is executed at the time you define the alias (not at the time of the first call to the alias. You must quote the $:

alias ss="import /home/User/Pictures/screenshots/screenshot-\$( date '+%Y-%m-%d-%H-%M-%S.png' )"

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.