Pergunta

If I run the code in my own terminal using

  sh projectbingo.sh 

it shows as:

Hello World

hi

When I run the following code :

 gnome-terminal  --window-with-profile=tushar -x ./projectbingo.sh

A new terminal pops out but shows :

./projectbingo.sh: line 3: $'\E[H\E[2J': command not found
./projectbingo.sh: line 23: $'\E[H\E[2J': command not found
./projectbingo.sh: line 77: $'\E[H\E[2J': command not found
Got bus address:  "unix:abstract=/tmp/dbus-  3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
Connected to accessibility bus at:  "unix:abstract=/tmp/dbus-    3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
 Registered DEC:  true 
./projectbingo.sh: line 79: $'\E[H\E[2J': command not found  
Got bus address:  "unix:abstract=/tmp/dbus-3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
Connected to accessibility bus at:  "unix:abstract=/tmp/dbus-3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
Registered DEC:  true 
./projectbingo.sh: line 82: $'\E[H\E[2J': command not found
./projectbingo.sh: line 107: $'\E[H\E[2J': command not found
Got bus address:  "unix:abstract=/tmp/dbus-3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
Connected to accessibility bus at:  "unix:abstract=/tmp/dbus-3G1IPFUIn6,guid=85293fb9a05e2828c07c371800000364" 
Registered DEC:  true 
./projectbingo.sh: line 110: $'\E[H\E[2J': command not found
./projectbingo.sh: line 116: $'\E[H\E[2J': command not found
 Hello World\n\nhi

Please help !!!

Foi útil?

Solução

This isn't a terminal issue. I suspect a shell issue.

Specifically, that $'...' notation is a bash-specific extension, but you are running the script simply by sh and not bash, so it won't apply.

Try changing the shebang line in the script to

#!/bin/bash

Outras dicas

It was not a shell specific issue . I do not know why it happened ... but when I used

   echo -e "Hello World\nHi"

It worked But when i try it running sh projectbingo.sh it shows

-e Hello World Hi

So My problem was solved but leading to the arrival of new problem

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top