Answer the question
In order to leave comments, you need to log in
How to find out the name of the previous command in a script?
There is a special bash variable "$_" which contains the last argument of the previous command. But how to get the whole previous command in a script?
for example:
#!/usr/bin/env zsh
fn() {
pre_command=...
echo $pre_command # выводит "date -I"
}
date -I
fn
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question