Bash Command Leads to CLI No Longer Drawing Commands
Garrett Andrews via Bug reports for the GNU Bourne Again SHell <[email protected]>
| Newsgroups | gmane.comp.shells.bash.bugs |
|---|---|
| Message-ID | <PAXPR08MB6527FCE58B9213BB2CC56C75E19FA@PAXPR08MB6527.eurprd08.prod.outlook.com> |
From: adbsg To: [email protected]<mailto:[email protected]> Subject: Bash command leads to cli not drawing commands anymore Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -g -O2 -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wall uname output: Linux uscmh-buildserver-mars-linux-cd-1 6.8.0-90-generic #91~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 20 15:20:45 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Machine Type: x86_64-pc-linux-gnu Bash Version: 5.1 Patch Level: 16 Release Status: release Description: When running a certain set of commands in a certain order, the user may get caught in a situation where they can no longer see the commands they are about to run. I was simply trying to get my CI/CD agent to delete all known hosts, populate known_hosts with the hosts being tested this run, then finally closing the session. This is so that I can exfiltrate data later from the devices that were tested. I am liking bash more and more and trying to use it in new ways, so could be user error, but at any rate, the commands should be drawn to the terminal, so that when I press Enter I know what will be run. I think the whole situation arises from doing an ssh connection, putting it in the background, sleeping a little, then killing the background ssh process that is awaiting a password. Repeat-By: [in the source file defined below the method] handle_ssh_connect () { # $1 is the target ip address to issue commands to # $2 is the command target_ip=$1 command=$2 ssh -o StrictHostKeyChecking=accept-new ${LINC360_USER}@${target_ip} & > /dev/null 2>&1 pid="$!" sleep 15 ps -ef | grep $pid kill -9 $pid sshpass -p ${LINC360_PASSWORD} ssh ${LINC360_USER}@${target_ip} $command } ... source ~/pipeline_functions.sh handle_ssh_connect 10.38.83.104 "touch hi" ... after running the 2 commands above, your terminal will no longer draw your commands to screen. hitting enter spends the buffer, meaning whatever command youve typed into the buffer will be executed, but will not be written to GUI. Best guess is ssh & causing it. Intent of code was to have CI/CD connect initially via ssh to add to known hosts (so i can pull data later). im sure there exists a more elegant way. [attached is a photograph of the cursed Terminal] [cid:[email protected]]
image001.png
(image/png, 336.5 KB) - not displayed