You are not logged in.

#1 2019-11-05 18:22:44

diesmond
Member
Registered: 2019-11-05
Posts: 8

[SOLVED] Unwanted output when starting terminal (urxvt)

So whenever I open my terminal the first line is just a "ls".
The standard line is also there, but the first thing to pop up is always the "ls".

I ran:

 echo exit | strace bash -li |& grep '^open[a-z]*' 

to get the files that are sourced when the terminal is opened and searched them for a possible cause but can't find anything.

Does anybody have an idea where else I could look or how to solve this some other way (clean reset of urxvt or something similar)?

Thanks in advance!

Last edited by diesmond (2019-11-06 19:10:00)

Offline

#2 2019-11-05 21:54:45

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,272

Re: [SOLVED] Unwanted output when starting terminal (urxvt)

So, does "bash -li" print the ls as well then?
Try "strace -f" to catch sub-processes.

Offline

#3 2019-11-06 15:28:35

diesmond
Member
Registered: 2019-11-05
Posts: 8

Re: [SOLVED] Unwanted output when starting terminal (urxvt)

Thanks for your response!

Yes bash -li also outputs "ls".
I'm not sure how you mean to use "strace -f".
I ran "strace -f bash" and "strace -f urxvt"  but the output is a bit daunting.
What should I be looking for?

Offline

#4 2019-11-06 15:50:35

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,272

Re: [SOLVED] Unwanted output when starting terminal (urxvt)

echo exit | strace -f bash -li |& grep '^open[a-z]*'

You could also add "set -x" on top of your bash_profile

If you don't get the "ls" output on regular invocations (w/o "-l") that should narrow the scope quite some.

Offline

#5 2019-11-06 19:07:30

diesmond
Member
Registered: 2019-11-05
Posts: 8

Re: [SOLVED] Unwanted output when starting terminal (urxvt)

Thanks these tools are great!

In the end the problem was something I don't quite understand:
I use rofi and wanted to create aliases there.
For that I wrote some aliases in the bash_aliases file and referred to it from bashrc.
This seems to have made the alias in bashrc not be recognized properly.

Here are the two files I used:

#
# ~/.bashrc
#

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

alias ls='ls --color=auto'
PS1='[\u@\h \W]\$ '

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

PATH=$PATH:~/Applications/clion-2019.2.4/bin
#~/.bash_aliases
alias | awk -F'[ =]' '{print $2}'
alias evince_sc='nohup run_scaled evince &>/dev/null &'
alias stremio_sc='nohup run_scaled stremio &>/dev/null &'
alias clion='clion.sh'

Is the problem the first line in bash_alias that is defining how to interpret an alias if I understand correctly?
It is weird because even though the line that was setting the alias in bashrc was causing the unwanted output the alias was still set correctly.

Anyways my main problem is solved, so thanks a lot.

Offline

#6 2019-11-06 20:22:26

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 78,272

Re: [SOLVED] Unwanted output when starting terminal (urxvt)

alias | awk -F'[ =]' '{print $2}'

will print all aliases (or rather the second field assuming a "=" separator), "ls" being the one you defined before.
I guess you copied that from somewhere w/o understanding what it does at all? Don't. You put a lot of trust into "somewhere" here.

Offline

Board footer

Powered by FluxBB