[Help-bash] How to only show bash variables but not those inherited from
From:
Peng Yu
Subject:
[Help-bash] How to only show bash variables but not those inherited from the environment?
Date:
Tue, 25 Dec 2018 12:03:02 -0600
Hi,
The following will show the xyz variable inherited from the
environment. Is there a way only show variables (global, or both
global or local if in a function) defined in the current script?
Thanks.
$ cat main1.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
compgen -v
$ xyz=abc ./main1.sh |tail -n 1
xyz
--
Regards,
Peng
[Prev in Thread]
Current Thread
[Next in Thread]
[Help-bash] How to only show bash variables but not those inherited from the environment?,
Peng Yu<=