[英]What is the command to print time\date with history in login shell script [on hold]
[英]using history command in the shell script
我正在嘗試在shell腳本中獲取命令歷史記錄。 除非我取出#!/ bin / bash,否則它不起作用
關於如何使它工作或在不刪除#!/ bin / bash的情況下達到相同效果的任何線索?
有人知道為什么刪除#!/ bin / bash起作用嗎?
當您刪除shebang行時,它將由您當前的shell運行。 除非您使用“交互式” shell,否則Bash將沒有任何歷史記錄可報告。 嘗試將您的shebang行更改為:
#!/bin/bash -i
這將導致bash
啟動交互式shell。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.