Permalink
Browse files

Implement $UID and $EUID (a bash extension)

Addresses issue #37.
  • Loading branch information...
Andy Chu
Andy Chu committed Sep 14, 2017
1 parent 89a89be commit 71bacc734d381cf5e89a4d0691af45c0f00731a9
Showing with 14 additions and 0 deletions.
  1. +4 −0 core/state.py
  2. +10 −0 spec/special-vars.test.sh
View
@@ -242,6 +242,10 @@ def _InitDefaults(self):
SetGlobalString(self, 'IFS', ' \t\n')
SetGlobalString(self, 'PWD', os.getcwd())
# NOTE: Should we put these in a namespace for Oil?
SetGlobalString(self, 'UID', str(os.getuid()))
SetGlobalString(self, 'EUID', str(os.geteuid()))
def _InitEnviron(self, environ):
# This is the way dash and bash work -- at startup, they turn everything in
# 'environ' variable into shell variables. Bash has an export_env
View
@@ -98,3 +98,13 @@ expr $0 : '.*/osh$' && exit 99 # Disabled because of spec-runner.sh issue
echo $RANDOM | egrep '[0-9]+'
# status: 0
# N-I dash status: 1
### $UID and $EUID
# These are both bash-specific.
set -o errexit
echo $UID | egrep -o '[0-9]+' >/dev/null
echo $EUID | egrep -o '[0-9]+' >/dev/null
echo status=$?
# stdout: status=0
# N-I dash/mksh stdout-json: ""
# N-I dash/mksh status: 1

0 comments on commit 71bacc7

Please sign in to comment.