Wednesday, November 26, 2014

Godfather Boursorama Banque: 120 euros offered! Rsync on a nonstandard port Perform an SSH connecti


A little bit of scripting in bash today with $ {...} Consider multimc a function like substr available in PHP, C, C ++, ... of taking a string (or string) and returns all or part of this channel (the so-called sub-string from which the substr multimc ing). This allows for example to retrieve the first 10 (or last) letters of a word or extract the letters present between 5th and 20th. Doing this is very simple bash through $ {NAME_OF_VARIABLE: INDICE_DE_DEBUT: NOMBRE_DE_CARACTERES_A_PRENDRE}: ma_variable_originale = "abcdefghijklmnopqrstuvwxyz" my_variable = $ {ma_variable_originale: 0: 10} The first variable contains the alphabet. The second will be assigned a substring of the first variable, multimc starting from the first character (the indices starting at 0, 0 for understanding the first character, multimc 1 for the second, etc.) and taking only 10 characters from 0. Let the final index the first 10 characters of the first variable. If we display the contents of the second variable ... echo "$ my_variable" ... we get abcdefghij Tag (s): #bash
E-mail
Godfather Boursorama Banque: 120 euros offered! Rsync on a nonstandard port Perform an SSH connection by providing the password in clear text on the line ... Doubling bandwidth with some ISPs bash Tip (= 22!): Retrieve the last argument used with $!


No comments:

Post a Comment