Etiquetes » Bash

How to access python return value from bash script

I’m trying to understand how to access from a bash script the return value of a python script.

Clarifying through an example:

def main():
    print ("exec main..")
    return "execution ok"

if __name__ == '__main__':
… 155 more words

Using Quotes with Commands in Scala Shell Scripting

Trying to utilize the following command in scala bash file (sys.process._ has been imported):

val writeToLine5 = "sed -i '5a some text' to.file".!

the following error emerges: … 181 more words


Music 3000 (PS2 game) reverse engineering: extracting samples

As per usual, a little bit of intro reading follows: A while back I stumbled upon a couple of PS2 games (or, more accurately, audio software) that I’ve been after for quite a while – … 625 more words



Something fascinating happens with me and Bash.  It causes a type of amnesia, the same thing happens with BigO notation; I can never remember it, no matter how long I use it or learning it, it always slips out of my mind shortly after I stop using it.  1.179 more words


Why should arithmetic operators be padded by space in expr?

Using expr to evaluate an expression in bash, the following happened

bash-3.2$ expr 1+1
bash-3.2$ expr 1 + 1

Why should the plus sign be padded by space for it to be interpreted as mathematical operation? 46 more words


Executing shell commands in c++ with exec

I’ve been given the assignment to write a small shell program in C++. It’s supposed to take the same commands as a regular bash shell (e.g.: mv, cmp, etc.) and then use fork() and exec() to call the bash version of the function. 371 more words


How to assign standard error stream output to a variable in bash?

I know that we can assign the output of a command in a script as below:

res=$(ls)    # assign the output of ls to res
… 88 more words