문제

I have tried the escape character but it doesn't seems works with !. I need this to auto-configure packages using scripts.

도움이 되었습니까?

해결책

! is magic in a default interactive bash session, but not in scripts (set +H to disable in an interactive prompt). In any case:

echo '#!/bin/bash'

다른 팁

Or with no quotes and escaping the # and the !:

echo \#\!/bin/bash

printf should work too:

printf '#!/bin/bash\n'
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top