Using 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...
1 year 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...
1 year ago

Shell script file testing

Bash
I have to do these steps: a. Accept the file name as command line argument b. Check for sufficient number of command line argument. c. Check if the...
1 year ago

expr displaying the expression rather than solving it

Bash
Here is my shell script, #! /bin/sh # basic calculator echo "Please input your choice" printf " 1.Addition \n 2.SUbstraction \n 3.Multiplication \n ...
1 year ago

Read Arduino data with shell script fast

Bash
My Arduino is recording temperature data (datatype float), which I'm trying to log on my Linux machine. The big problem is the speed of this logging....
1 year ago

In Linux terminal, how to delete all files in a directory except one or two

Bash
How to delete all files from a folder except one or two in a Linux terminal? For example. I have 100 image files in a directory and one .txt file. I...
1 year ago

How to show the lines in a terminal

Bash
I am using Ubuntu server. When I type, say, "python3 --help", a long list of commands shows. So long that I can't see the lines that were written firs...
1 year ago

Pipe the output from three echo statement to mail

Bash
echo "Total items: `echo $QUERY1 | awk '{print $1}'`" echo "Total Error: `echo $QUERY1 | awk '{print $2}'`" echo "Percentage: $QUERY2" How can I sen...
1 year ago

recursively add file extension to all files

Bash
I have a few directories and sub-directories containing files with no file extension. I want to add .jpg to all the files contained within these direc...
1 year 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, ...
1 year ago

How to execute a file that is located in $PATH

Bash
I am trying to execute a hallo_word.sh that is stored at ~/bin from this script that is stored at my ~/Desktop. I have made both scripts executable. B...
1 year ago

how to check which version of nltk, scikit learn installed?

Bash
In shell script I am checking whether this packages are installed or not, if not installed then install it. So withing shell script: import nltk echo...
1 year ago

Replace whole line containing a string using Sed

Bash
I have a text file which has a particular line something like sometext sometext sometext TEXT_TO_BE_REPLACED sometext sometext sometext I need to r...
1 year 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...
1 year ago

how to get the total size of certain folders in bash?

Bash
How can I get the total size of the certain folders? For example I have a list of specific folder names in users.txt # cat users.txt user1 user2 use...
1 year ago

Exit a Script On Error

Bash
I'm building a Shell Script that has a if function like this one: if jarsigner -verbose -keystore $keyst -keystore $pass $jar_file $kalias then e...
1 year ago

How to use 'sed' in shell script to replace a line in a file

Bash
I've a file with a line contains special characters like % ^ #$ @#$. I tried to use sed tool to replace this line with pattern like this (name=value w...
1 year ago

How do I fix my shell script for this curl command

Bash
Hey guys I'm running a shell script through a few loops to acquire records but the curl command is giving me an invalid json error, what am I doing wr...
1 year 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 # ...
1 year ago

Command works in terminal, but not with Runtime.exec

Bash
I'm trying to run some commands from a Java application using Runtime.getRuntime().exec(command). However, certain commands that work from a command l...
1 year ago