Friday 16 February 2018

Quik Larn Bash Script

Hello guys inwards this article, i'll live on sharing amongst yous or then of my as well as other people's  noesis inwards or then technologies that yous may genuinely using right now, hither yous tin discovery or then useful shortcut as well as functions that tin live on useful for yous if yous are a pupil or mortal else that he/she merely got stuck trying to discovery the right command line.

I encourage yous who is reading this article to start taking notes most anything yous are doing it volition live on useful for yous offset to discovery whatever yous are looking for rapidly as well as yous tin aid other people to bring this noesis past times sharing it amongst them if yous are already doing this that's Awesome.

Feel complimentary to add together to a greater extent than materials or alter wrong statements  past times contributing into this github repository

Our actual contributors:
Smriti SManral

We are going to separate this article into iii parts :
Linux ascendance lines
Bash Script ascendance lines
Vim ascendance lines


Without farther delay let's larn started :)



 Count of arguments

  • * $#

To download something using curl

  • * wrap -O [url]

List of all arguments

  • * $@

Print entire array

  • * echo ”${array[@]}”

Copy the positional params to an array:

  • * args=("$@")   

To iterate over args using uncomplicated for

  • * for ((i=0; i<=$#; i++))
  • * do””
  •  echo ${!i} 
  • * done

Iterate over array

  • * for ((i=0; i<${#args[@]}; i++)); 
  • * do
  •       echo "$i  ${args[i]}  ${args[i-1]}  ${args[i+1]}"
  • * done

To banking enterprise represent if file exists

  • * if [ -f $filename ]
to banking enterprise represent if give-and-take acquaint inwards a file
  • * if [ $(grep ”$word" $filename) ]

To banking enterprise represent non equal

  • ne

To banking enterprise represent greater than as well as greater than equal

  • * -gt
  • * -ge

To banking enterprise represent equal

  • eq

To banking enterprise represent less than & less than equal

  • * -lt
  • * -lt

To convert temp from F to K


To append a work inwards a file if non already present


To plow CSV file to comma delimited sentence



Count no. of fourth dimension programme is executed




SHARE THIS

Author:

Just a regular website is not the website of incredible, but not also means the site is not responsible for all of what is in it, in this case the Admin, who manages this site fully responsible to what-what is published in it.

0 comments: