1- What's the use of script command?
Sometimes commands make more sense in the context of other commands that are meant to be used with it. If you check the
SEE ALSO section of the manpage, you see:
csh(1) (for the history mechanism), scriptreplay(1), scriptlive(1),
scriptreplay - play back typescripts, using timing information
scriptreplay [options] [-t] timingfile [typescript [divisor]]
This program replays a typescript, using timing information to ensure
that output happens in the same rhythm as it originally appeared when
the script was recorded.
The replay simply displays the information again; the programs that
were run when the typescript was being recorded are not run again.
scriptlive - re-run session typescripts, using timing information
scriptlive [options] [-t] timingfile [-I|-B] typescript
This program re-runs a typescript, using stdin typescript and timing
information to ensure that input happens in the same rhythm as it orig‐
inally appeared when the script was recorded.
The session is executed in a newly created pseudoterminal with the
user's $SHELL (or defaults to /bin/bash).
script you can make a recording you can use to replay a session (like a video but with text), or re-execute it. Re-executing would be useful in cases where you want to do something in a TUI and repeat your actions with optionally the same timing.
2- Why command script -qc "exit 1" returns exit code 0?
Its main job is to record, so it makes sense to return success when it successfully recorded, even if it recorded failure. However, there's also
--return if you wanted the return value to be passed:
Return the exit status of the child process. Uses the same for‐
mat as bash termination on signal termination (i.e., exit status
is 128 + the signal number). The exit status of the child
process is always stored in the type script file too.