سؤال

I've been creating mac shell executables with this method:

  • Create a file;
  • Add #!/bin/sh;
  • Add the script;
  • Run chmod 755 nameofscript.

I now need to create a shell script to create a shell script in another directory and make it executable (with chmod) so that it can be run on startup.

هل كانت مفيدة؟

المحلول

#!/bin/sh

dir=/tmp
fnam=someshellscript

echo '#!/bin/sh' > $dir/$fnam
echo 'find /bin -name "*X*"' >> $dir/$fnam
chmod 755  $dir/$fnam

نصائح أخرى

#!/bin/sh
echo "script goes here!" > /path/to/place
chmod 755 /path/to/place

?

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top