Questions tagged as 'shell-script'

1
answer

What's the difference between / bin / bash and / usr / bin / env bash?

I do not know much about shell script, I have always used /bin/bash , but I noticed other variations: #!/usr/bin/env bash #!/usr/bin/bash #!/bin/bash What's the difference between them? As far as I...
asked by 01.08.2016 / 18:00
3
answers

How to insert a line break inside echo in shell script?

I wanted to know if there is any way to insert a line break within the echo of the shell script. For example, in the command: echo "Bom dia fulano" I would like the output to be: Bom dia fulano I know you can do it like this:...
asked by 09.07.2015 / 13:25
3
answers

How to remove the "4 980 Raphael" space between numbers only

I have a String "980 Rafael" and I would like to know how I will remove only the spaces that are between the numbers in shell script.     
asked by 14.03.2017 / 12:46
2
answers

Copy everything before the first blank line

I have a file with several blocks of text separated by a blank line. Ex.: block1 block1 block2 block3 block3 I need a solution with sed, awk or perl that finds the first blank line and redirects the previous block to another file a...
asked by 11.12.2015 / 19:34
2
answers

Shellscript can not find directory

I'm starting with shellscript, I have to do the checksum of some files, so I decided to automate things with a bash script. I made two scripts, one that uses a ls recursive in the directory set by me and ignores folders by taking only the * ('...
asked by 01.11.2016 / 22:01
2
answers

What is a binary operator

I made a code in bash: #!/bin/bash echo "Digite o arquivo: " read ARQUIVO PROCURA=$(find /home/gabriel -name $ARQUIVO) test $PROCURA -e & echo "O arquivo '$ARQUIVO' não foi encontrado" And when you run it you get the following error me...
asked by 16.05.2017 / 05:40
2
answers

How to get the current path of a .sh script?

On Linux-based systems whenever I need to use the following command: #!/bin/bash BASEDIR=$(dirname "$0") echo $BASEDIR I have however read in different places that $(dirname "$0") is not supported by Mac OS X systems and BSD-based...
asked by 01.08.2016 / 17:51
2
answers

How to get result of selection of menu gdialog in variable in Shell Script?

I'm creating a simple script for learning in which the user should: Type number to be saved in variable NUM1 Enter a second number that will be saved in variable NUM2 Choose from the menu if it wants to add, subtract, multiply or...
asked by 09.03.2017 / 17:56
1
answer

How can I extract only the PID of a process?

My idea is to create a simple script that can search the PID of a process and kill it for example. This is what I have done so far but has the problem of running 'ps' will not extract the PID. echo "nome do processo : " read $matança ps -ax...
asked by 17.02.2017 / 00:02
1
answer

google API - gcalcli - error while executing in a script

Continuing with my issue reported here now I can send shell-script events directly to google calendar, I made a script to execute as scheduled, it follows sms.sh file strong> below #!/bin/bash let oneminf='date +%s'+600 dateonemin='date -...
asked by 23.04.2015 / 22:23