#if you want to display the contents of a file on the terminal, do:
$ cat filename.file
$ VAR='/home/pax/file.c'
$ DIR="$(dirname "${VAR}")" ; FILE="$(basename "${VAR}")"
$ echo "[${DIR}] [${FILE}]"
[/home/pax] [file.c]
#!/bin/bash
firstString="I love Suzi and Marry"
secondString="Sara"
echo "${firstString/Suzi/"$secondString"}"
# prints 'I love Sara and Marry'
#/usr/bin/env bash
DIRECTORY="/home/user/example/foo/bar"
BASE_DIRECTORY=$(echo "$DIRECTORY" | cut -d "/" -f2)
echo "#$BASE_DIRECTORY#";
APP_ROOT=$(dirname $(dirname $(readlink -fm $0)))
for each in "${alpha[@]}"
do
echo "$each"
done
#!/bin/bash
value=$(pwd)
regex='.*/([a-zA-Z0-9._]*)/([a-zA-Z0-9._]*)$'
echo You are here: $value
echo The folder is: ${value##*/}
[[ $value =~ $regex ]]
echo Parent folder: ${BASH_REMATCH[1]}
$/> npm init -y