25 lines
1.3 KiB
Plaintext
25 lines
1.3 KiB
Plaintext
#######################################################################################
|
|
#
|
|
# Copyright (c) Huawei Technologies Co., Ltd. 2019. All rights reserved.
|
|
# security-tool licensed under the Mulan PSL v2.
|
|
# You can use this software according to the terms and conditions of the Mulan PSL v2.
|
|
# You may obtain a copy of Mulan PSL v2 at:
|
|
# http://license.coscl.org.cn/MulanPSL
|
|
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
|
|
# PURPOSE.
|
|
# See the Mulan PSL v2 for more details.
|
|
# Description: Append the history list to the history file.
|
|
#
|
|
#######################################################################################
|
|
|
|
set el_precmd_msg = `history 1|cut -f3-|sed -e "s|{||g" | sed -e "s|}||g"`
|
|
set el_precmd_user = `whoami`
|
|
set el_precmd_loginuser = `who -m | awk '{print $2" "$NF}'`
|
|
set el_precmd_num = `history 1| awk -F" " '{print $1}'`
|
|
|
|
if ((${el_precmd_num} != ${LastComandNum_for_history}) && (${LastComandNum_for_history} != "" || ${el_precmd_num} == 1)) then
|
|
logger -t "[/bin/csh]" "[${el_precmd_msg}]" "by [${el_precmd_user}] from [${el_precmd_loginuser}]" > /dev/null
|
|
endif
|
|
set LastComandNum_for_history = ${el_precmd_num}
|