Por meio do método de origem, está funcionando
meu arquivo_de_origem.sh contém
# cat /root/source_file.sh
#!/bin/bash
history -d $1
e meu master_file.sh tem linhas abaixo
# cat /root/master_file.sh
#!/bin/bash
if [ "$1" == "" ]; then
echo -e "Enter command number from history(syntax: source script_name.sh xxxx)"
else
source /root/source_file.sh && echo -e "Line number $1 removed successfully"
fi
podemos testar o script agora,
# source /root/master_file.sh
Enter command number from history(syntax: source script_name.sh xxxx)
ok, vamos adicionar o número da linha
# history | tail -n 10
1193 grep disable /etc/sysconfig/selinux
1194 grep enforce /etc/sysconfig/selinux
1195 sestatus
1196 arch
1197 uname -r
1198 uname -a
1199 history
1200 history | tail -n 10
1201 pwd
1202 history | tail -n 10
Vamos remover a linha 1196
# source /root/master_file.sh 1196
Line number 1196 removed successfully
# history | tail -n 10
1194 grep enforce /etc/sysconfig/selinux
1195 sestatus
1196 uname -r
1197 uname -a
1198 history
1199 history | tail -n 10
1200 pwd
1201 history | tail -n 10
1202 source /root/master_file.sh 1196
1203 history | tail -n 10