1

Im trying to create an alias that captures my terminal using script when im updating my packages.

scripttime() {
    script --timing=${1-typescript}.time ${1-typescript}.log
}
alias update-n-log='scripttime ~/log/test/test.$(date +%d-%m-%YT%H-%M-%S); update_me'

This only runs the update_me command after the script recording is done. Can i automate script capture in an alias? I tried to google for it but the name script makes it hard to find anything relevant.

1 Answer 1

2

Short answer: script -c update_me seems to be what you are looking for, at the core. And it also seems like the alias is superfluous -- It can just be a single function:

update-n-log() {
  FILENAME_BASE="~/log/test/test.$(date +%d-%m-%YT%H-%M-%S)-typescript"
  script -c update_me --timing=${FILENAME_BASE}.time ${FILENAME_BASE}.log
}

P.S. Freebie Google tip -- Searching for "script terminal recording" (without the quotes) came up with some better hits, but I agree -- It's a rough name to search for.

Also don't forget to man script.

1
  • Thank you very much, it worked. altho i had to change the tilda '~' to $HOME for that to work, seems like ~ would not translate into its path in a string and script would not accept that path, i also changed update me to "UPDATE_COMMAND" and defined it in the function for better readability, just my style. Commented Jul 16, 2021 at 10:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.