2015-05-13 188 views

回答

5

是的這是完全可行的!

#!/bin/bash 

FILE="/tmp/generated.bash" 

cat <<END > $FILE 
#!/bin/bash 

echo "Hello There from generated script!" 
END 

chmod 755 $FILE 
echo "running ...." 
$FILE 
echo "done" 

要給你喜歡的輸出:

[tmp]=> ./test.bash 
running .... 
Hello There from generated script! 
done