Catch no args passed

This commit is contained in:
Vlad Doster 2020-04-10 15:26:32 -05:00
parent f2713f45b6
commit 95d5d05075

View File

@ -1,5 +1,10 @@
#!/bin/bash #!/bin/bash
# Deletes certain lines of ~/.ssh/known_hosts # Deletes certain lines of ~/.ssh/known_hosts
if [ $# -eq 0 ]; then
echo "Usage: ./delete_certain_known_hosts 3 5 7 23"
echo "Will catch duplicate line numbers"
exit 1
fi
known_hosts_path=~/.ssh/known_hosts known_hosts_path=~/.ssh/known_hosts
lines_in_known_hosts=$(wc -l "$known_hosts_path" | awk '{print $1}') lines_in_known_hosts=$(wc -l "$known_hosts_path" | awk '{print $1}')
IFS=' ' IFS=' '