scripting-languagethunar

Script to append timestamp prefix to variable


I've got a Thunar script with this only line: cp "$@" "$@-$TS".txt it appends a timestamp suffix and the .txt extension to the file I right-click in

Now, I want to append a timestamp prefix and also add the .txt extension, but it doesn't work: cp "$@" "$TS-$@".txt

What am I doing wrong?


Solution

  • Well, I've found a solution. Replace geany with your favourite text editor.

    #!/bin/sh
    TS=$( date +%Y%m%d-%H%M%S )
    cp "$@" $TS.txt
    geany $TS.txt