0
votes
2answers
37 views

move all files in local directory to remote directory

I want to move all files in local directory to remote directory. And I am using this code to achieve itSOURCE_FILE=/var/www/oneserver/*TARGET_DIR=/var/www/anotherServerARCHIEVEFILE=/var/www/...
0
votes
1answer
20 views

How to copy environment variables from local shell to a remote ssh connection inside a shellscript?

I am currently working on a shell script that is used to build docker images and restart containers running on the remote host. below is the stripped down version of the code.#!/bin/bash -xe# ...
1
vote
1answer
20 views

Terminal is not running any command after using command “cat > .bashrc”

I was customizing my terminal by screenfetch. after installing screenfetch in my ubuntu, I have used some commandcat > .bashrc# Start Screenfetchscreenfetchthen I pressed ctrl + d and closed ...
0
votes
2answers
26 views

Bash scripting: run a shell command from inside a script with variable inside quotes

I need to load a db into a mysql server and the following command works from the shell:From shellmysql -h "172.17.0.2" -u "root" "-pmypasswd" -Bse "create database mydb;"But not from the script, ...
0
votes
1answer
40 views

Assign values to variable from text file. Search for the string in file. Replace the string in file?

I am working on a project where I need to correct some thousand lines of data. I have already completed the half work and now I am stuck on final part.I have a file called tree.txt which has list of ...
0
votes
0answers
37 views

Cronjob taking a screenshot every hour with scrot

One of my users needs a webpage screenshoted every hour. I was able to find a utility called scrot and it was easy setting up a cronjob to run every hour. My issue is it takes a screenshot of both ...
0
votes
1answer
18 views

What is producing an inconsistent conditional find result?

I'm writing a small script that gets assorted file stats about two different file extensions (*.parquet OR *.metadata) in an arbitrary directory. I need to get these file stats only from files that ...
0
votes
1answer
42 views

CentOS 7: Can't connect via WinSCP when bash is executed

I'm running CentOS Server 7 on a VM (ESXi) with root permissions. I have a bash script (in my /etc/profile.d/ directory) which is executed immediately after login. Before I created my .sh file in the ...
0
votes
1answer
22 views

From bash script, play sound through internal speakers, while leaving them effectively disabled otherwise

I posted a similar question earlier, but Kamil Maciorowski correctly & wisely pointed out that, as posted, it wasn't really the single problem it appeared to be, but an amalgam of 3. So I deleted ...
0
votes
1answer
51 views

Can you have a terminal file in Linux like windows Batch? What is the extension?

It has been a while since I downloaded my Kali Linux on a Windows virtual machine (VirtualBox not VMware). On my Windows host I have created numerous batch scripts that can execute "cmd code" with a ....
3
votes
2answers
148 views

How to force bash script to wait for user answer?

There are already similar questions but I'm posting this because none of the answers worked.I'm writing a bash script to automate the installation of pacman and AUR packages on my Arch system. The ...
0
votes
1answer
33 views

Extract tar.gz files into a directory with different basename based on their match in the text file

I have hundred of folders, some with with tar.gz files and some with bam files. I just wanted to extract tar.gz files into a different directory. Folders with tar.gz files looks like mentioned below:...
2
votes
2answers
50 views

Detect if command has printed to stderr

I have this program in C#include <stdio.h>int main() {char foo[10];int i;for(i=0; i < 20 ; i++) {foo[i]=0;}return 0;}If I run this script#!/bin/...
0
votes
2answers
98 views

How can I make this Bash variable work: myformat=“--format=fuller --date=format:%Y-%m-%d T%H” [on hold]

This is a question about how Bash handles word grouping and variable expansion. I will demonstrate the question with a very specific example:bash$ git log --format=fuller --date=format:"%Y-%m-%d T%H"...
0
votes
0answers
7 views

How to forcefully stop an endless loop in Upstart “pre-start script”?

I have the following pre-start script in one of my Upstart configurations:pre-start scriptcd "$(dirname "$(dirname "$(readlink "/etc/init/${UPSTART_JOB}.conf")")")". "lib/upstart/waitFor[...]....
3
votes
2answers
50 views

With Bash variables, what is the difference between $myvar and “$myvar”? (Specific odd behavior)

General Question:In Bash, I know that using the variable myvar can be done in two ways:# Define a variable:bash$ myvar="two words"# Method one to dereference:bash$ echo $myvartwo words# ...
1
vote
0answers
21 views

Finding where an env variable is set

I have the problem that my http_proxy is wrongly set, whenever I start a new terminal:» echo $http_proxy http://http://127.0.0.1:1234/Which is ... bad. I have a bug somewhere in my environment ...
0
votes
5answers
78 views

moving files and folders to a subfolder

I would like to move all files and folder from one directory to one of its subfolders. How do I do that?I am using BusyBox and linux.ex:move all files and folder in /my/path/ to /my/path/...
2
votes
0answers
52 views

Can't install linux-libc-dev on WSL/Bash on Ubuntu on Windows

I'm trying to install linux-libc-dev on Bash on Ubuntu on Windows (the Windows Subsystem for Linux).This is to fix an earlier bash error:The following packages have unmet dependencies:libc6-dev : ...
0
votes
1answer
18 views

syntax error near unexpected token `>' in script run by cron

I'm writing a shell script for Mac OS/Linux. The script is run by a cron job. I'm trying to append stdout and stderr to a log file. My command(simplified) looks like this(line 5 in myscript.sh):...
2
votes
2answers
87 views

Linux Command > output.txt with delay

My issue is that when I run my script it continues past a command below:top -b > output.txtThe data on machine is quite large and therefore it takes some time to retrieve the full stack of CPU ...
0
votes
2answers
27 views

splitting up a file: substitute `egrep` in `sed`

I want to split my $file containing x lines in half, and check how many lines contain "dead" in a log. I started off with the following:half=`expr $(egrep -c . $file) / 2`sed -n 1,${half}p $file |...
0
votes
0answers
31 views

Get lan ip address [duplicate]

I want to retrieve my ip address on my local area network. I know that I can do the following:$ ip address show enp0s72: enp0s7: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel ...
0
votes
1answer
78 views

Standard Unix/Linux utility for testing every input line

I am writing a Bash script which should test if every line in input meet certain condition.Is there a way to take the predicate and reduce all the line to either 0 or 1 so I don't have to code the ...
0
votes
1answer
18 views

Debian 9: bash: ls, cat, command not found after incorrectly modifying PATH

Most of the commands are no longer working after modifying PATH.Instead of PATH=$PATH:/home/z***d/Programs/anki-2.0.50it ended this way export PATH=PATH:/home/z***d/Programs/anki-2.0.50 wasn't ...
0
votes
0answers
9 views

source bash command redirection between aws linux and macos

I want to redirect the output of a subshell into source. So for example:say.shecho "hello"source_test.sh#!/usr/bin/env bashsource <(cat http://superuser.com/say.sh)When I run http://superuser.com/source_test.sh, this prints ...
-1
votes
0answers
18 views

rc.local and systemctl fail to run a program correctly on startup but crontab runs it as expected

I have a program that runs as a daemon on a system at boot. I've been trying to transition away from cron but I'm finding it difficult because the alternatives leave the program in a locked sleeping ...
3
votes
1answer
46 views

Meaning of VAR=* in bash

I saw the following (to start a nodejs express web server) and I can't find documentation about the * in this: prompt>> DEBUG=* commandThis sets DEBUG to a temporary value in the command's ...
0
votes
0answers
27 views

Invisible and unremovable .lnk-file exists (copied by Cygwin), directory cannot be removed

I copied a Windows-".lnk-file" using Cygwin from a Windows-source- to a Windows-target-directory.The copied file does not show up in the target-directory, although the system behaves as if the file ...
0
votes
0answers
11 views

wget - N always redownloads file even if timestemp does not change

I found this site on how to download files, of which the timestamp did change:https://www.gnu.org/software/wget/manual/html_node/Time_002dStamping-Usage.htmlI tried it out but wget always keeps on ...
1
vote
1answer
20 views

7zip Linux command line - excluding directories

I'd like to make a .7z archive of my website using 7zip; there are a few directories that contain large files (several gigabytes) not worth backing up, as I already have backups of them. I could ...
0
votes
1answer
38 views

Why does debian not autocomplete all git commands?

I am running debian$ cat /etc/os-releasePRETTY_NAME="Debian GNU/Linux 9 (stretch)"NAME="Debian GNU/Linux"VERSION_ID="9"VERSION="9 (stretch)"ID=debianHOME_URL="https://www.debian.org/"...
0
votes
0answers
27 views

Certain LS results unreadable with Solarized theme on Windows 10 Linux subsystem

After fiddling around for a while, I was able to get Bash on Windows to use the Solarized color scheme via the method discussed in this thread. It even allows me to have vim switch over to the light ...
2
votes
1answer
79 views

How to convert this string to Japanese using GNU/Linux tools?

Here is a string from a text file:@™TdaŽ®Æ‚êƒ~ƒNƒXƒgƒŒ[ƒgEƒrƒLƒjver1.11d1.d2iƒrƒLƒjƒ‚ƒfƒ‹ver.1.1³Ž®”z•z”ÅjIt includes many nonprinting characters and is copied here: https://pastebin.com/...
-2
votes
2answers
66 views

search for values after strings-multiple columns

I have this file (output.txt):name:some name^M^Mcount:1^M^Mregion:some_regionname:some name^M^Mcount:2^M^Mregion:some_region^M^Mname:some ...
0
votes
2answers
60 views

Shebang, interpreter and a script

One can use shebang line to provide the interpreter to use to execute a script:#!/bin/bashecho "Hello world"My question is how can we determine in the script which interpreter is indeed used. The ...
0
votes
2answers
64 views

Search file for specific string and remove it

I have following file:http://superuser.com/foldername/company_users_policies_changes.txt"terraform_automated_python","AdministratorAccess"http://superuser.com/foldername/company_groups_policies.txt"terraform_automated_python","...
0
votes
1answer
103 views

Universal method of opening some sort of BASH shell on Linux

I was wondering if there was a universal method of opening a BASH terminal on all (or atleast most) linux distributions, using keyboard shortcuts.This can be accessing the TTY using the f1..12 keys,...
-2
votes
2answers
44 views

Prepend lines to HTML file

i have following HTML file:<table border="1" class="dataframe"><thead><tr style="text-align: right;"><th>Users</th></tr></thead>&...
1
vote
2answers
36 views

Portable way to find all PIDs by cmdline

I want to find the PID of all processes which were run by a cmdline call which contains a certain string my_exec.For instance, with macOS or Ubuntu, open a terminal and run /bin/bash, and then in ...
0
votes
0answers
11 views

How can't I type colon (:) when inside cssh (cluster ssh administration tool)?

I'm using cssh for firing a series of commands to a number of virtual machines at the same time. It works fine almost all the time.However, for whatever reason it is... if I have to type "http:" for ...
0
votes
2answers
64 views

Bash alias to start/stop multiple service

I am a developer working with LAMP stack.My pc run arch linux so it is systemd based.it has a limited amount of ram 8Gb:sometime I use it for work sometime for play games I want to easily ...
0
votes
1answer
91 views

Trouble doing backup with tar using the results of find command

So I'm doing this perl script to backup my music. It will search for new music added to my disk since the last backup.When this command runs:find ~/Music -type f -mtime -145 | xargs tar -cvf ...
0
votes
1answer
43 views

Meaning when linux filename autocomplete ends with 'invisible' “\ ”?

Have a file that when viewed in the graphical file explorer or lsed in a terminal looks like "LLCP2015.ASC", but whenever the terminal autocompletes (via tab) a command like less LLCP2015.ASC it ...
1
vote
1answer
69 views

Find and copy folders recursively but keep the structure

My problem: I've got two folders, i.e., ~/foo and ~/bar. Both have got the same structure like ~/[foo/bar]/subdir1 and ~/[foo/bar]/subdir2 and inside these subdirectories in foo are folders like .svn/...
1
vote
2answers
48 views

Pipe output from program to a dynamic named file (contains date)

I am still a bottle feeding linux newbie, so go easy. I've googled myself this far but can't find the answer.I'm running a program that outputs csv data, and piping it to log.csvI'm looking for a ...
0
votes
0answers
28 views

How does Bash handle variables in memory?

I just challenged myself to find and change a value in memory using scanmem and wrote this script to increment a simple value every 5 seconds.#!/bin/bashi=88 #start counting from..printf "...
0
votes
2answers
44 views

Bash :: append text to output of file

I am very new to Shell Scripting so this maybe a very easy solution but i'm struggling to get it to work.I have a file with this content:example1.eu example2.eu example3.euWhat I am trying to ...
0
votes
1answer
14 views

Remote Copy of All Traits of a File Except for its Content

Everything described below is done via a Bash script.I desire to capture the state of a defined set of files on a defined set of remote hosts. The "state" of a file depends on the type of file:...
1
vote
2answers
87 views

Is there a bash helper that show common examples while typing

Is there a script or configuration or other tool that can show you inline most common examples of usage of given command for ex. user type:tar and it shows tar xzvf my-archive.tar.gz ls and it ...

153050per page