Reputation: 1125
As an example, I am trying to capture the raw commands that are output by the following script:
https://github.com/adampointer/go-deribit/blob/master/scripts/generate-models.sh
I have tried to following a previous answer:
BASH: echoing the last command run
but the output I am getting is as follows:
last command is gojson -forcefloats -name="${struct}" -tags=json,mapstructure -pkg=${p} >> models/${p}/${name%.*}_request.go
What I would like to do is capture the raw command, in other words have variables such as ${struct}
, ${p}
and ${p}/${name%.*}
replaced by the actual values that were used.
How do I do this?
Upvotes: 2
Views: 982
Reputation: 2762
At the top of the script after the hashbang #!/usr/bin/env bash
or #!/bin/bash
(if there is any) add set -x
set -x Print commands and their arguments as they are executed
Upvotes: 2
Reputation: 3801
Run the script in debug mode which will trace all the commands in the script: https://stackoverflow.com/a/10107170/988525.
You can do that without editing the script by typing "bash generate-models.sh -x".
Upvotes: 0