Let's say I have something like this:
#!/bin/bash
var1=1
var2='two'
third='cat'
abcd='dog'
.
.
.
.
something='else'
env
Now I want print all variables declared inside my script.
I tried env, but yea... it prints environment vars not my local ones..
Also cat /proc/$$/environ doesnot give me what I want as its equal to env.
Running my script with more debug info bash -x ./myscript.sh does not suit me.
Is there any trick to list all vars with their values?
 
     
    