Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Getting a "-bash: [: : integer expression expected" error on bash shell startup in arch

Anytime I startup my bash shell I’m getting this pervasive "-bash: [: : integer expression expected" error, which leads me to my .xinitrc, .bashrc, and .bash_profile. I just chaged my /etc/X11/xinit/xinitrc before this started happening, which leads me to believe it’s related, but I’m stumped.

I was in the process of setting up xrdp, which might be a factor.

~/.xinitrc

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

exec i3
#exec sh /home/username/.screenlayout/display.sh

~/.bashrc

#
# ~/.bashrc
#

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '
alias i3-config='vim .config/i3/config'
alias polybar-config='vim .config/polybar/config'
alias wallpaper='feh --bg-fill --randomize /home/username/Pictures/Wallpapers/'
export CHROME_EXECUTABLE='google-chrome-stable'
export JAVA_HOME='/usr/lib/jvm/java-8-openjdk'
export ANDROID_SDK_ROOT=$HOME/android-sdk
export PATH=$PATH:/opt/flutter/bin
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
export PATH=$PATH:`pwd`/flutter/bin
export PATH=$PATH:$HOME/.pub-cache/bin
source /usr/share/nvm/init-nvm.sh
export GITLAB_API_TOKEN='blahblahblah'
export NPM_TOKEN='blahblahblah'
alias tailscale-torrent='sudo tailscale up --exit-node=xxx --exit-node-allow-lan-access=false'
alias tailscale-normal='sudo tailscale up --exit-node= --reset'
alias dvorak='setxkbmap us dvorak'
alias us='setxkbmap us'
alias pia-client='/opt/piavpn/bin/pia-client'
alias vmware-background='sudo vmware &'

umask 002
export SYSTEMD_EDITOR=vim

~/.bash_profile

#
# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc

if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
        exec startx
fi

/etc/X11/xinit/xinitrc

#!/bin/sh

userresources=$HOME/.Xresources
usermodmap=$HOME/.Xmodmap
sysresources=/etc/X11/xinit/.Xresources
sysmodmap=/etc/X11/xinit/.Xmodmap

# merge in defaults and keymaps

if [ -f $sysresources ]; then







    xrdb -merge $sysresources

fi

if [ -f $sysmodmap ]; then
    xmodmap $sysmodmap
fi

if [ -f "$userresources" ]; then







    xrdb -merge "$userresources"

fi

if [ -f "$usermodmap" ]; then
    xmodmap "$usermodmap"
fi

# start some nice programs

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi


twm &
xclock -geometry 50x50-1+1 &
xterm -geometry 80x50+494+51 &
xterm -geometry 80x20+494-0 &
exec xterm -geometry 80x66+0+0 -name login

I’ve tried cleaning up my bashrc and bash_profile with no luck

>Solution :

Replace [ "${XDG_VTNR}" -eq 1 ] in your .bash_profile with [[ "${XDG_VTNR}" == 1 ]] so your .bash_profile looks like this:

# ~/.bash_profile
#

[[ -f ~/.bashrc ]] && . ~/.bashrc

if [ -z "${DISPLAY}" ] && [[ "${XDG_VTNR}" == 1 ]]; then
        exec startx
fi

That should remove the error in the case that $XDG_VTNR is not set or not a number.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading