Я не знаю то, чего Вы пытаетесь достигнуть, но если Вы хотите считать, когда сделал Вас, выполняет определенную команду, Вы могли контроль Ваша история оболочки и предварительно ожидать время, это выполнялось. От man bash
:
HISTTIMEFORMAT
If this variable is set and not null, its value is used as a
format string for strftime(3) to print the time stamp associated
with each history entry displayed by the history builtin. If
this variable is set, time stamps are written to the history file
so they may be preserved across shell sessions. This uses the
history comment character to dis‐tinguish timestamps from other
history lines.
Если это недостаточно для Вас, Вы могли контроль script
. Это - утилита, которая сохраняет все, что Вы вводите (и это производится) на оболочке в файл:
$ script /tmp/shell-output
Script started, file is /tmp/shell-output
$ echo everything is send to /tmp/shell-output, Even ssh sessions started here
ОТРЕДАКТИРУЙТЕ, Если Вы хотите выполниться script
от ~/.bashrc
, Вы лучше ограничиваете удар для не чтения Вас RC
файл:
$ script -c 'bash --norc' -f /path/to/saved_file
Ваша оболочка не передает кавычки до сценария. Если Вы хотите передать кавычки, выйдите из них с обратной косой чертой:
# ./script.sh asd \"asd\" \'asd\'