Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
5
Impact
~753 people reached

  • 0 posts edited
  • 0 helpful flags
  • 1 vote cast
Jul
20
comment Setting the group of a Unix process
@Kaarel: Oops, yes.
Jul
19
comment What is the simplest scriptable way to check whether a shell variable is exported?
Also there's an inconsistency, -z "$1" assumes I'm passing the value of a variable to test_var (as I was) whereas declare -p expects its name. I came up with this test which takes the name of a shell variable: test_exported_notnull () { re='^declare -\w*x'; [[ -n $(eval echo \$$1) ]] && [[ $(declare -p "$1") =~ $re ]]; } .
Jul
19
comment What is the simplest scriptable way to check whether a shell variable is exported?
It looks like attempting to quote the regular expression stops it working as a regular expression in bash >= 3.2.
Jul
19
comment What is the simplest scriptable way to check whether a shell variable is exported?
I think that this is what I'm looking for. In theory, the re might need to be more flexible, e.g. if I had a read-only exported variable, but in practice I never use other typeset attributes.
Jul
19
comment What is the simplest scriptable way to check whether a shell variable is exported?
This does work but I was hoping for a lighter answer with fewer implied forks (hence "Short of [...] grepping the output of export") as my planned use is in my prompt.
Apr
27
comment Copy the contents of one partition to another partition hardrive
possible duplicate of stackoverflow.com/questions/2719186/…