export HOME=/root export PATH=$PATH:/etc:~/bin # source URL data from v86 (file created by v86 during boot) test -f /mnt/profile.browser && source /mnt/profile.browser # source xrsh env source /etc/profile.xrsh # source shell functions source /etc/profile.sh # source user shell defaults test -f ~/.profile && source ~/.profile # source js functions test -f /etc/profile.js && chmod +x /etc/profile.js && /etc/profile.js | grep -v undefined # source user js functions test -f ~/.profile.js && chmod +x ~/.profile.js && ~/.profile.js | grep -v undefined ## forward not-found commands to javascript (via jsh) command_not_found_handle(){ echo "[!] '$1' not found, did you mean $1(...) (javascript?)" test -n "$ONBOARDING" && echo "[i] type 'help' for handy commands" test -n "$ONBOARDING" || help_tips } help_tips(){ echo "" echo 'TIPS' echo '----' echo 'text editors ' "type ' '" echo 'programming languages ' "type 'ls ~/bin/helloworld*'" echo 'run 64bit linux app ' "type 'blink '" echo 'js run ' "type 'js 'alert(\"hello\")'" echo 'js console.log: ' "type 'console document.baseURI" echo 'js function as cmd: ' "type 'alias $1=\"jsh $1\"' to run '$1 yo' as $1('yo')" echo 'js inspect: ' "type 'js \"return document.baseURI\"'" echo 'js console mute: ' "type 'echo 0 > /dev/browser/tty' to disable" echo 'js capture console: ' "type 'tail -f /dev/browser/console'" echo 'jsh<->sh hooks: ' "type 'chmod +x ~/hook.d/*/* && alert helloworld'" echo 'include file into page' "type 'require '" echo '' echo 'type "help" or "man xrsh" to read the full manual' ONBOARDING=1 } export TERM=xterm-256color export PS1="\[\033[38;5;165m\]> \[\033[0m\]" # aliases alias ls='ls -ha -w100' # interactive login [[ -t 0 ]] && { test -n "$STY" || { resize # call twice resize # otherwise COLUMNS/ROWS is 0 # add URL-hash as extra screen session test -z "$HASH" || { grep 'screen -t #' /root/.screenrc || { echo "screen -t xrsh+URL 3 /bin/sh -c '${HASH}; sh'" | sed "s/'#/'/g" >> /root/.screenrc } } screen -Aa -R -T screen-256color -c /root/.screenrc } test -n "$STY" && cat /etc/motd }