While I type a command, this command will authenticate with a remote server and do a bunch of things. If pass, it will give me a bash shell with its environment.
My goal is to save these log which prints out into my terminal for future inspection. Let's say my command called target
.
While I type target, it throws the following msg.
Version: V1.94
Options:
Date: Thu Jun 6 17:18:39 2019
OS: CentOS release 6.10 (Final)
....
[DEV]target>
Notice the last line implied I've entered the target shell environment.
I've tried echo $(target) > output.log
, but it will be stuck until I type CTRL+C
.
Environment: CentOS 6.10
Update
Let's say I want to make this script automatically run when I activate my machine. However, it will still be stuck while executing the target command because it entered a shell and didn't leave.
#!/bin/bash
script -c target output.log
FILENAMEME=output.log
aws s3 cp "$FILENAME" s3://logs/