Questions tagged as 'bash'

1
answer

What does '2' and '&' mean in Bash?

I'm starting to study Bash and while analyzing some code in Github, I came across the following excerpts to create a theme: which rbenv &> /dev/null || return $(node -v 2> /dev/null)     
asked by 02.03.2015 / 15:33
1
answer

How to extract the path to the file

In a variable containing the path to a file and its name, the file name can be extracted as follows: #!/bin/bash filenamepath="/caminho/para/ficheiro.pdf" filename=$(basename $filenamepath) What results in ficheiro.pdf in variable...
asked by 26.03.2015 / 11:20
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

In bash, what is the difference between, and?

I'm now learning to tinker with bash (Ubuntu Terminal) and would like to understand the difference between these three operators. I think < is related to files, but I can not explain what it does descriptively. I think it's t...
asked by 26.08.2015 / 18:35
1
answer

Convert PDF document pages to JPGs

The following code is working inside the desired one, where it receives parameters in order to convert all the pages of a PDF file into JPG files: ID ( natural number ) Absolute path (must exist and point to PDF file) system user (must e...
asked by 26.03.2015 / 13:56
4
answers

How can I request a user confirmation in a bash file?

I need to display a message on the Console and ask for a confirmation. For example, ask the user to type SIM to continue, and check this.     
asked by 09.03.2014 / 21:43
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
2
answers

Using variable with the sed command

I have the following occurrence: DirUpload=/var/log find $DirUpload | sed 's/$DirUpload//g' The question is, how to use variable along with sed?     
asked by 11.10.2016 / 20:40
2
answers

Difference between til "~" and slash "/" at the linux prompt?

I'm starting a lower level part, where I'll schedule the users part, permissions and etc. My first question is ~ and / at the prompt?     
asked by 15.09.2017 / 13:53
1
answer

How do I Debug BASH Scripts?

How can I debug bash scripts? In DOS from Microsoft I can use the @echo ON and @echo OFF. I would like to use something similar on Linux.     
asked by 18.03.2014 / 16:08