I want every command ran from a bash script to be echoed with the custom prefix of ##[command]. This has a meaning when the script is run from Azure Pipelines.
For example, when running ls -l from such a script I would like to see something like this:
##[command]ls -l
total 20
-rw-r--r-- 1 mark mark 2447 Nov 14 23:56 1.txt
-rw-r--r-- 1 mark mark 1533 Nov 14 23:56 2.txt
-rw-r--r-- 1 mark mark 1545 Nov 14 23:56 3.txt
-rw-r--r-- 1 mark mark 6918 Nov 14 23:56 4.txt
The solution could be something automatic or some kind of a function, which could be invoked like this: run('ls -l').
Using a function means there would be a special step in every build job to ensure this function is defined in the .bashrc script, so that subsequent steps could see it. At least, this is what I think, not sure if bash steps load the .bashrc script at all.
Anyway, the solution should be applicable to multiple steps in an Azure Pipeline YAML without a lot of overhead.