SHELL

https://ryanstutorials.net/linuxtutorial/filters.php

commit only if some changes are there :

if [ -n "$(git status --porcelain)" ]; then
git add/git commit
fi

cut command usage:
v=$(echo "$file" | cut -d '/' -f2)

using jquery with curl for json output:

file=`curl -u "$bbUser":"$bbPass" "https://bitbucket.pearson.com/rest/api/1.0/projects/GLP/repos/glp-application-config-common-bitesize/pull-requests/$key/diff" | jq '.diffs[].source.toString'`

looping in shell:
for i in `cat test.txt`;
do
echo $i
done
grep/sort/awk:
grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}
or cd 'Holiday Photos'

Another method is to use what is called an escape character, which is a backslash ( \ ). What the backslash does is escape (or nullify) the special meaning of the next character.

    cd Holiday\ Photos
    pwd
    /home/ryan/Documents/Holiday Photos

to know what a command does type man:
e.g. man ls
man -k to get what a manual command does

touch: create a blank file

----------------------------------------------------
----------------------------------------------------

Wildcards

----------------------------------------------------
----------------------------------------------------

    * - represents zero or more characters
    ? - represents a single character
    [] - represents a range of characters



----------------------------------------------------------------------------------------------------------------

Filters
--------------------------------------------------------
--------------------------------------------------------

head [-number of lines to print] [path]
tail  [-number of lines to print] [path]
sort [options] filename
sed 's/search/replace/g' sample.txt
uniq file.txt
tac- print last lines first


top
    View real-time data about processes running on the system.
ps
    Get a listing of processes running on the system.
kill
    End the running of a process.
jobs
    Display a list of current jobs running in the background.
fg
    Move a background process into the foreground.
ctrl + z
    Pause the current foreground process and move it into the background.


----------------------------------------------------------------------------------------------------------------

vi
    Edit a file.
cat
    View a file.
less
    Convenient for viewing large files.
-----------------------------------------------------------------------------------------------------------------
gitIDTag=`echo ${GIT_COMMIT} | cut -c 1-10`              















Comments

Popular Posts