blob: 188265b4f09ed7e29295a8127caec6f1ece6afc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# Interactive: login profiles, ENV (parameter-expanded), and prompt escapes.
command -v python3 >/dev/null 2>&1 || exit 77
mkdir home
printf 'echo "profile read"\nPROFILE_VAR=yes\nPS1="$ "\n' >home/.profile
# /etc/profile comes first and a Linux distribution's version may be
# bash-flavoured: it can fail on a construct only bash understands, and it
# sets USER from the account database. Drop the first from the transcript
# and put USER back for the \u test (ENV is read after the profiles).
printf 'echo "env file read"\nalias ll="echo aliased"\nUSER=tester\n' >home/envfile
HOME=$PWD/home ENV='$HOME/envfile' PS1='$ ' HISTFILE='' USER=tester \
python3 "$TESTS/tools/ptydrive.py" "$TSH" -l >out 2>&1 <<'END'
expect env file read
send echo "var=$PROFILE_VAR"\r
expect var=yes
send ll\r
expect aliased
send PS1='[\\u] '\r
expect [tester]
send cd; PS1='\\W:\\x> '\r
expect home:\x>
send PS1='a\\\\b> '\r
expect a\b>
send PS1='multi\\nline> '\r
expect line>
send PS1='$ '\r
send echo done\r
expect done
send exit\r
END
grep -v -e 'bad substitution' -e 'not found' -e 'syntax error' out
|