Show error when type letters on search option (pwsh-vault-cli)

This commit is contained in:
q3aql 2022-06-18 17:06:41 +02:00
parent 53f54fee5d
commit ca1c2b567e

View File

@ -1122,6 +1122,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} logins) corrupted_result=$(check_corrupted_entry_vault ${result} logins)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1150,6 +1153,11 @@ function search_entries_vault() {
echo "# Entry logins/${result} CORRUPTED" echo "# Entry logins/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1183,6 +1191,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} logins) corrupted_result=$(check_corrupted_entry_vault ${result} logins)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1211,6 +1222,11 @@ function search_entries_vault() {
echo "# Entry logins/${result} CORRUPTED" echo "# Entry logins/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1250,6 +1266,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} logins) corrupted_result=$(check_corrupted_entry_vault ${result} logins)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1273,6 +1292,11 @@ function search_entries_vault() {
echo "# Entry logins/${result} CORRUPTED" echo "# Entry logins/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1308,6 +1332,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_logins} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} logins) corrupted_result=$(check_corrupted_entry_vault ${result} logins)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1331,6 +1358,11 @@ function search_entries_vault() {
echo "# Entry logins/${result} CORRUPTED" echo "# Entry logins/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1370,6 +1402,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} bcard) corrupted_result=$(check_corrupted_entry_vault ${result} bcard)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1393,6 +1428,11 @@ function search_entries_vault() {
echo "# Entry bcard/${result} CORRUPTED" echo "# Entry bcard/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1426,6 +1466,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_bcard} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} bcard) corrupted_result=$(check_corrupted_entry_vault ${result} bcard)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1449,6 +1492,11 @@ function search_entries_vault() {
echo "# Entry bcard/${result} CORRUPTED" echo "# Entry bcard/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1487,6 +1535,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} notes) corrupted_result=$(check_corrupted_entry_vault ${result} notes)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1502,6 +1553,11 @@ function search_entries_vault() {
echo "# Entry notes/${result} CORRUPTED" echo "# Entry notes/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi
@ -1535,6 +1591,9 @@ function search_entries_vault() {
echo "# Invalid entry. Type number entry or 'b' option." echo "# Invalid entry. Type number entry or 'b' option."
echo "" echo ""
else else
expr ${search_show_entry} + 1 &> /dev/null
error=$?
if [ ${error} -eq 0 ] ; then
result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2) result=$(cat ${pwsh_vault_cache_notes} | head -${search_show_entry} 2>/dev/null | tail -1 | cut -d "," -f 1 | cut -d "/" -f 2)
corrupted_result=$(check_corrupted_entry_vault ${result} notes) corrupted_result=$(check_corrupted_entry_vault ${result} notes)
if [ ${corrupted_result} -eq 0 ] ; then if [ ${corrupted_result} -eq 0 ] ; then
@ -1550,6 +1609,11 @@ function search_entries_vault() {
echo "# Entry notes/${result} CORRUPTED" echo "# Entry notes/${result} CORRUPTED"
echo "" echo ""
fi fi
else
echo ""
echo "# Invalid entry. Type number entry or 'b' option."
echo ""
fi
fi fi
done done
fi fi