How to use bash to replace specific text from variables in a config file?

Bash
I have a config file. E.g. config.cfg product_name = "test_product" table_name = "test_table" and I have an input file: input.sql DROP TABLE cg_c...
2 years ago

How to make rsync read SRC from STDIN?

Bash
I want to dump my MySQL database and make daily backups with rsync. First approach I came up with is something like mysqldump -ufoo -pbar baz > /v...
2 years ago

Extract common part text from number of lines in shell script

Bash
I want to extract common part of text from given number of lines. Input: /dir1/dir2/dir3/dir4/a/file1/dir /dir1/dir2/dir3/dir4/b/file2 /dir1/dir2/dir...
2 years ago

How to auto login mysql in shell scripts?

Bash
I have a mysql server with empty root password. I want to execute some sql statements in shell scripts without specifying the password like this: co...
2 years ago

Usign echo command as stdin in shell?

Bash
I was trying to search for a way how to use echo with a program I have written in C. The program takes a word from stdin as input and I would like to...
2 years ago

Bash simplified sudoku

Bash
So,I have to write a bash script to check if a 9x9 "sudoku" solution is valid,but the simplification is that I don't have to divide it into 3x3,but ju...
2 years ago

Shell Script - Get name of dynamically generated file

Bash
I'm very new to shell script and therefore I don't now very much about it. I have an application, which creates a java file with a half unknown name, ...
2 years ago

Save file content from editbox in BASH

Bash
I want to learn shell-scripting. I want to create simple tool to show file content with edit option but I can't get value from dialog --editbox. Anybo...
2 years ago

Error for convert command in command line

Bash
I have a bash shell script as below. #!/bin/bash SIZES=("512" "1024" "2048") for i in ${!SIZES[*]} do SIZE=${SIZES[$i]} echo $SIZE # ...
2 years ago

Why does my bash function handle arguments as a string?

Bash
I am attempting to gather my ip address and subnet bits (such as 192.168.2.17/24) to pass to fing along with a name to scan a network and create a set...
2 years ago

How to search multi line string with order in shell script?

Bash
I have a file containing a list of strings, for example: abc search1 lkj sdfdgs search2 kkd #search3 search3 How can I keep all lines matching sear...
2 years ago

Bash - Update terminal title by running a second command

Bash
On my terminal in Ubuntu, I often run programs which keep running for a long time. And since there are a lot of these programs, I keep forgetting whic...
2 years ago

Where does, Carp library in Perl, print logs when run from crontab

Bash
I have a Perl script that uses Carp (carp croak) to print info and errors. When run directly I can see the output on console. But when I am running th...
2 years ago

Grep user input to find number

Bash
I have a File which looks like this example text [1234] [0] Part 2 /var/tmp/path example text [1234] [0] Part 3 /var/tmp/path example text [1234] [0]...
2 years ago

How to execute a command and get output of command within C++?

Bash
I am looking for a way to get the output of a command when it is run from within a C++ program. I have looked at using the system() function, but tha...
2 years ago

how to make screenfetch appear automatically

Bash
Im trying to make screenfetch command execute automatically. I opened bash file using nano~/.bash_profile typed screenfetch in , pressed ctrl O ,...
2 years ago

add last column to the file from another file

Bash
I want to add column 2 of FileB in the last column of FileA if the first column of both files matches. FileA 12345,4567,12345,4567 56789,1234,56789,...
2 years ago

Process grep gives ambiguous output

Bash
I have this init.d script where i am checking the status of an application, The expected output should be "Application is running with PID: XXXX" An...
2 years ago

Pass array to awk which contains the column numbers which need to be printed

Bash
I have a CSV file (usvd.csv) which contains 41 columns, my bash script process the headers row to workout which columns to print, the result is I need...
2 years ago

How can I directly put a return value of a bash function into an if-statement?

Bash
I have following function which checks connection for internet (I know there are better ways to check for internet connection but that's not the topic...
2 years ago