我想为我的 django 应用程序做一个自动 collectstatic 脚本。我尝试了各种方法,但没有奏效。我的最后一次尝试是在普通脚本中调用一个期望脚本:
收集静态.sh:
python manage.py collectstatic --settings=app.settings_mark &&
./testscript.sh
Run Code Online (Sandbox Code Playgroud)
测试脚本.sh:
#!/usr/bin/expect -f
spawn testscript.sh
expect "Type 'yes' to continue, or 'no' to cancel:"
send "yes"
Run Code Online (Sandbox Code Playgroud)
但是,该行./testscript.sh
永远不会执行,因为collectstatic
之前的命令正在等待输入。我怎么能跳过那个?我也试过省略,&&
但没有用。
提前致谢 !
我想添加这个
#this
##is my
text
Run Code Online (Sandbox Code Playgroud)
行前
the specific line
Run Code Online (Sandbox Code Playgroud)
我试过这个
sed -i '/the specific line/i \
#this
##is my
text
' text.txt
Run Code Online (Sandbox Code Playgroud)
但它只添加了“文本”。
我也试图与不同的组合\
和" "
,但毫无效果。
我正在构建我的第一个 debian 包 (django),它需要一些依赖项,所以我想知道是否可以使用apt-get
.
例如代替
pip install gunicorn==19.3.0
apt-get install gunicorn==19.3.0
(这显然不起作用,只能apt-get install gunicorn
起作用,但是它将安装最新版本)
最终,这应该进入文件的Depends
部分control
。
有任何想法吗?
我有一个登录到我的 Beaglebone 的期望脚本:
#!/usr/bin/expect -f
spawn ssh debian@192.168.7.2
expect "debian@192.168.7.2's password:"
send "temppwd\r"
interact &&
mkdir emma &&
cd emma
Run Code Online (Sandbox Code Playgroud)
这有效并且它登录到 debian 帐户。但是,它会在interact
其他两个命令未执行后停止。我该怎么做才能做到这一点?
编辑
好的,谢谢 andy256 我想这interact
是错误的,但是,我明白了
执行时无效的命令名称“mkdir”
如何将期望脚本与普通 shell 脚本结合起来?
提前致谢 !