In sh-mode I am getting following flycheck-error message:

File   Line [v]ColLevel   ID     Message (Checker)
config.sh  2     error           Syntax error: "(" unexpected (sh-posix-dash)

for the following line: strings=("hello" "world") . But this is actually a valid expression in bash.

complete file:


strings=("hello" "world")

init.el file has following lines, reference:

(define-derived-mode my-cfg-mode sh-mode "My CFg Mode"
 "A mode for my CFg files."
 (sh-set-shell "bash"))

Is it possible to suppress this warning message?

  • Can't reproduce it: flycheck is happy with it. What does the complete file look like? Is there a shebang on line 1? And what is sh-posix-dash?
    – NickD
    Dec 6, 2022 at 22:32
  • @NickD sh-posix-dash is one of the shell checkers in flycheck
    – nega
    Dec 6, 2022 at 23:00
  • 2
    @alper if you're using bash, use the bash checker.
    – nega
    Dec 6, 2022 at 23:00
  • @NickD Yes sir there is #!/bin/bash line (updated on my question). flycheck-sh-posix-dash-executable is set to nil
    – alper
    Dec 7, 2022 at 9:51
  • @nega How can I set bash checker from the init.el file?
    – alper
    Dec 7, 2022 at 9:52

1 Answer 1


As checker sh-posix-dash was enabled. When I add following lines into my init.el file the problem is solved.

(with-eval-after-load 'flycheck   
    (setq-default flycheck-disabled-checkers '(sh-posix-dash)))

As @Ian mention core cause was due to following lines, hence also removing those lines from my init.el file was also resolved the conflict:

(define-derived-mode my-cfg-mode sh-mode "My CFg Mode"
"A mode for my CFg files."
(sh-set-shell "bash"))
  • 1
    I think you have a chicken-egg problem: why did you added those three lines in your init.el file? You did not copied the whole example, which defines a derived mode for a .cfg file, while your file is still a .sh file, so you created yourself a problem. Try to remove those lines, you do not need them to have correct behavior. Neither to disable a checker.
    – Ian
    Dec 8, 2022 at 9:06
  • @Ian Honestly I couldn't remember why I added those three lines(indicated in my question) in my init.el file :-( I was thinking they are required for something I was using but instead they were causing conflict like you mentioned. I updated my answer, please feel free to edit
    – alper
    Dec 8, 2022 at 10:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.