[Linux/BashScript/Vim] Encrypted vim file, cat util.

cat_vim_file.sh

===============
#!/bin/bash

usage()
{
  echo "$1 <filename>"
}

FILENAME=$1

if [ "$FILENAME" == "" ]; then
  usage $0
elif [ -f ${FILENAME} ]; then
  echo -n "EnterPassword:"
  # Without echo (-s)
  read -s szPassword
  echo $szPassword| vim -es '+%print' '+:q!' $FILENAME
else
  echo "FileNotFound: $FILENAME"
  usage $0
fi
===============

Reference: https://stackoverflow.com/questions/3980668/how-to-get-a-password-from-a-shell-script-without-echoing

Comments

Popular posts from this blog

e1000e 0000:00:1f.6 eno1: Detected Hardware Unit Hang

[WordPress] Change https redirect in DB.

sanitize on in CMakeLists.txt