Mis*_*hko 1 bash ruby-on-rails ruby-on-rails-3
我使用以下内容创建了reset_db.sh (with chmod +x
):
#!/bin/bash
echo "*** Deleting the database ***"
rake db:drop --trace
echo "*** Creating the database ***"
rake db:create --trace
echo "*** Migrating the database ***"
rake db:migrate --trace
echo "*** Seeding the database ***"
rake db:seed --trace
echo "*** Done! ***"
Run Code Online (Sandbox Code Playgroud)
但是,当我运行时:
bash reset_db.sh
Run Code Online (Sandbox Code Playgroud)
我懂了:
*** Deleting the database ***
*** Creating the database ***
*** Migrating the database ***
*** Seeding the database ***
*** Done! ***
Run Code Online (Sandbox Code Playgroud)
但rake
没有执行命令。
任何想法为什么?
奖金问题:
我应该怎么做才能运行reset_db.sh
而不是bash reset_db.sh
?
添加set -x
在 bash 脚本的顶部以获得更详细的输出。
#!/bin/bash
set -x
echo "*** Deleting the database ***"
rake db:drop --trace
echo "*** Creating the database ***"
rake db:create --trace
echo "*** Migrating the database ***"
rake db:migrate --trace
echo "*** Seeding the database ***"
rake db:seed --trace
echo "*** Done! ***"
Run Code Online (Sandbox Code Playgroud)
这是否为您提供了更多信息?
归档时间: |
|
查看次数: |
2393 次 |
最近记录: |