Skip to content
Advertisement

Tag: shell

How echo grave accent symbol in bash

(_ is input, i think) Answer Escape the grave accent. It’s special to the shell and is one way (the archaic one) to do command substitution. As noted by @dave_thompson_085 an alternative is to use single quotes in lieu of the double quotes you used, or to specify the hexadecimal representation of the grace accent, by doing echo “x60”. You

Difference between “${param[0]}” and ${1} in bash

I’m looking at some old scripts and I found some parameter assignment that I have not seen before. A while loop reads from a text file and passes the values to a function. The items in the text file look like this: the first stage of the function then looks like this: I have not seen this sort of assignment

how to extract part of log file bash [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 11 months ago. The community reviewed whether to reopen this question 10 months ago and left it closed: Original close reason(s) were not resolved Improve this question I have a log

If condition met, yet doesn’t run in Bash script

Sorry if a silly question. I have a script that doesn’t behave how it’s intended even though a condition is met. My script is something like this: I’ve tried declaring the state variable in different ways but non seem to work; also tried [ $output = $state ] [ “$output” = “$state” ] [[ ]] but nothing works. I think

Print min and max with awk

Why wont this awk script work, where I want to print the min and max of an input by just reading the data once. I would also like to initialize the min and max variable with the first value of the data. Say I have a file I am using awk to print the min and max with: But I

Linux setting variables

I’m running a shell script into Linus and I have a unexpected behavior. It looks like it is not concat both strings but rather it is appending data at the beginning. Any suggestion? Regards Answer When the value of TOOLBOX_ROOT was set, it had a carriage return ($’r’) at the end of it. As a result, the value of the

Advertisement