history-del

This commit is contained in:
archikid08
2026-02-23 19:46:37 +01:00
parent 45f4ae2458
commit 10eb0fa915
2 changed files with 8 additions and 25 deletions
-25
View File
@@ -1,25 +0,0 @@
#!/usr/bin/bash
if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
echo "Usage: $0 arg1 [arg2] [arg3]"
exit 1
fi
# interactive session check
if [ -t 0 ]; then
echo -n "Delete existing output files? [y/N]: "
read ans
case "$ans" in
y|Y) rm -f *.school ;;
*) echo "Aborted"; exit 0 ;;
esac
fi
# process input file
while IFS= read -r line; do
new_f="${line%.*}.school"
f > "$new_f"
done < "$FILE"
exit 0
+8
View File
@@ -0,0 +1,8 @@
#!/usr/bin/bash
NB_LINES=${1:=5}
for ((i=0;i<NB_LINES;i++))
do
history -d $(history | tail -n 1 | awk '{print $1}')
done
history -w