سؤال

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