1

When I edit bash script(first line is #!/bin/bash) in GEdit, there is no highlighting. But with View->Highlight Mode, there is no result when searching "bash" or "script", which to choose?

4
  • @ user68186 That doesn't work for my Ubuntu. The key seems to be the extension. When I remove .txt, gedit will treat it as bash even it is not executable. As a Windows user, I generally add txt to all generic files in Ubuntu.
    – jw_
    Nov 19, 2019 at 5:05
  • Why do you not want to use the .sh suffix for scripts instead of .txt? There's no harm in having descriptive extensions.
    – DK Bose
    Nov 19, 2019 at 5:27
  • @Justice for Monica Currently the file is a text file that I used to pass data between Windows host and Ubuntu VM, and this time I pass and edit a script. Will create a .sh for that.
    – jw_
    Nov 19, 2019 at 5:29
  • The first time you save the file, the synthax highlighting will become in effect.
    – vanadium
    Nov 19, 2019 at 10:14

1 Answer 1

1

In gedit there is no bash or script highlighting mode. The closest that they have is the sh highlight mode.

Plaintext mode:

enter image description here

View -> Highlight Mode -> sh then select:

enter image description here

sh highlight mode selected:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .