bash

How to run sctipt b based on script a result

I’ve got two working sctipts: a.sh, b.sh. I would like to create one script which will do the following: 1. Run a.sh 2. Running b.sh is dependant on the output of a.sh so wait for a String from a.sh standatd output saying ‘a.sh launched’ only then run b.sh If this is too trickyto to implement then perhaps simply wait for…
Read more

Bash script error: bad fd number

I’m using a script to modify some mailboxes on a Zimbra server hosted on a Ubuntu server. This script checks if mailbox exists and, if so, proceeds the required change. I get the error scriptname.sh: 4: Syntax error: Bad fd number Here’s the script: #!/bin/bash email=$1 echo “Looking for $email” /opt/zimbra/bin/zmprov ga “$email” displayName > /dev/null 2>&1 if [ $?…
Read more

Shell script for CD command not working [duplicate]

This question already has an answer here: Stay in directory changed after ending of bash script 6 answers In Shell scripting i am trying to execute a shell script by saving it as .sh file in some location and then in putty executing sh test.sh , test.sh being the filename. I do not have anything much written in the code…
Read more

Git Bash Open Command Windows

I’m extremely new to the command line and just programming in general. I use windows, and I’m doing prep work for viking code school. In one of the lessons it asks us to use the ‘open’ command in Git Bash (we were to download Git Bash if we weren’t on Linux or Mac) which will not work for me. When…
Read more

Package management in git for windows?

I’m reading wiki on github for git and it says that msys2 bundles pacman: https://github.com/git-for-windows/git/wiki/Package-management But when i’m invoking it: $ pacman bash: pacman: command not found Does anyone has an idea what is going on? To which git version this wiki refers? Is there a way to install additional packages to msys2 inside Git for windows? Source: bash

Add all arguments except first to a string

Trying to parse all arguments to one string but my code is only giving me errors that it cant find i test: line 3: =: command not found test: line 7: [i: command not found test: line 7: [i: command not found test: line 7: [i: command not found test: line 7: [i: command not found test: line 7: [i:…
Read more

How this two spliting method differs in bash?

I am struggling earlier with a string splitting in bash. After some search i have found two method of doing this that split a string and make an array of that splitted parts. But when i am printing them i am getting different result. a=”hello,hi,hola” method 1: IFS=’,’ read -ra arr <<< “$a” echo “${arr[@]}” Output: hello hi hola Method…
Read more

Print bash arguments in reverse order

In an intro to software engineering class, i have to write a script, which will take all arguments and print them in reverse. I’ve made a solution, but find it very bad. Do you have a smarter idea? #!/bin/sh > tekst.txt for i in $* do echo $i | cat – tekst.txt > temp && mv temp tekst.txt done cat…
Read more