Questions tagged as 'bash'

1
answer

How can you increase dates in a shell?

Description: I need to take a date in dd / mm / yyyy format and increase the day. For example, having a date 01/01/2017 , the idea is to have the following output: 02/01/2017 Code: I am trying with date -d "${fecha_ultim...
asked by 06.01.2017 / 21:29
3
answers

insert data into MySQL database with bash

I have a script that converts me some files, I create the folders if they do not exist and move them to a desired path. echo "estacion: "$st; fcha=$year2"-"$month"-"$day; echo "fecha: "$fcha; echo $archivoF " =...
asked by 15.09.2016 / 22:01
1
answer

Extract url from a header using bash script

I have been trying for quite some time to extract part of a text (a header) in bash script but I have not succeeded, this is what I have: link: <https://api.some.com/v1/monitor/zzsomeLongIdzz?access_token=xxSomeLongTokenxx==>; rel...
asked by 04.02.2016 / 19:32
1
answer

Operate with powers of decimals in shell

I'm trying to make a shell script that takes numeric data that are usually decimal of type 0.00004 and I have to square them. Using "bc" the result I get 0. Example: echo "(0.0000003+0.0000005)^2"|bc 0 Looking at the help of bc, he says...
asked by 06.04.2018 / 22:57
1
answer

Detect executables in bash [closed]

I am new in the bash language (GNU / linux) and a question has arisen in an exercise: I have to go through all the files in a directory, and for those that are executable, I save a variable 1, or a 0 in case of not being executable. I tried t...
asked by 31.03.2017 / 21:35
3
answers

How do you compare chains in Bash?

I'm using Bash in Linux and I found an example in which I compared the strings in this way but apparently it does not work. In this case, $a is what the user writes to the console. #!/bin/bash a=$1 if [ "${a}"=="static" ]; then (inst...
asked by 17.02.2017 / 06:13
1
answer

Use a cycle in bash with cat

I am using cat in bash to merge several files into one, as there are more than a thousand folders I do not want to do an instruction for each folder, how can I do a cycle so you can go through all the folders and join the files of the...
asked by 27.01.2016 / 22:52
2
answers

How does this Sed command work? [closed]

I wanted to know how this command works letter by letter, I do not understand it. find <directorio> -type d | sed -e 's;[^/]*/;|____;g;s;____|; |;g' The part of find <directorio> -type d I understand it well, which would...
asked by 06.09.2018 / 14:48
4
answers

BASH - Renaming files

I have to rename the files ending in ".cpp" to ".cc". For this, I thought of the following code: #!/bin/bash route="." if [[ $# -eq 1 ]]; then route=$1 fi for file in $(find $route -name *.cpp) do newName=$(dirname $file)'/'$(basenam...
asked by 31.10.2016 / 20:30
1
answer

This alias does not work, apparently well written

I added this alias to jo/.bashrc : alias lm='cd /home/jose/Escritorio/GRADO\ SUPERIOR/.lmfinal/' However, every time I type lm I do not get it.     
asked by 05.07.2017 / 20:05