Hi I am trying to create script which will after run copy its content inside another file with different name (time dependent to debugging pruposes) my idea is something like that
#!/bin/bash
content="printf \"#!/bin/bash\\n%s\" \"$content\" >> \`date +%s+%M\`"
printf "#!/bin/bash\ncontent=%s\n%s" "$content" "$content" >> `date +%s+%M`
This script of course doesn't work because after run it didn't append last line correctly.
As a result I got something like this:
#!/bin/bash
content=printf \"#!/bin/bash\n%s" "" >> `date +%s+%M`
printf "#!/bin/bash\n%s" "" >> `date +%s+%M`
I had also tried with 'echo' rather than 'printf' but with echo it is even more complicated and because of my weak bash skills I am unable to figure out how to fix it. Also after hour of trying I am unable to discover any way how to fix this.