Questions tagged [bash]
Bash is a free shell for Unix-like operating systems from the GNU Project.
988
questions
0
votes
1
answer
3k
views
running for loop - but wait for string of words in log file to continue
so far I have this:
for each in {01..10} ; do ./sb0$each/tomcat_sb0$each start;done
that will start my apps at once, but I want it to wait until it reads one line in a file, what's the easiest way ...
0
votes
1
answer
252
views
alias: extract options from command
Apologies for the bad title. I couldn't come up with a better one.
I want to alias a command to another command, and extract options from the text of the command itself. I realize this is unclear, ...
0
votes
2
answers
185
views
Showing a stack of ssh connections in terminal
I had this idea for long time and tried several ways to implement, with no luck. Tried to google many times and always finding not quite what is needed.
How to do:
$ ssh hostA
|----------------------...
0
votes
2
answers
2k
views
Is there a unix command to output time elapsed during a command?
I love using time to find out how long a command took to execute but when dealing with commands that execute sub-commands internally (and provide output that allows you to tell when each of those sub-...
0
votes
3
answers
765
views
Problems with Bash 4.2.45 on Ubuntu
I am using a remot server running Ubuntu 13.10 with Bash 4.2.45 installed. My home system is OS X Mavericks with Bash 3.2.51 (Darwin build) installed. I haven't used bash much in the past but I've ...
0
votes
2
answers
262
views
Log in using SSH without password
On my server, I've got openssh-server and a special account without password. I'm creating a shell script, that must be used without user input. For example
$(ssh [email protected])
I need script ...
0
votes
2
answers
587
views
Is it possible to get SSH to forward empty arguments?
I'm trying to execute a remote script with SSH, and this script changes its behavior depending on whether or not a specific argument is empty. Here's a minimal example, where I created a simple tmp.sh ...
0
votes
1
answer
192
views
Is there a limit on how many entries the 'Control R' bash shortcut searches?
I have increased my bash history limit to 10000 and I see that my bash history has grown to approximately 6000 entries. However when I try to search my history using 'Ctrl R', it searches only a ...
0
votes
1
answer
2k
views
Mac OS X 10.6 executable not found without full path
I just installed Apache via MacPorts. It seems that my Mac was absolutely confused about which version of the Apache executables to run.
After moving the Apache executables that ship with the Mac to ...
0
votes
2
answers
822
views
sum numbers in different lines in shell
i have 8000 lines similar to this
<Flow flowId="1" timeFirstTxPacket="+0.0ns" timeFirstRxPacket="+924100.0ns" timeLastTxPacket="+199984927558.0ns" timeLastRxPacket="+199675473275.0ns" delaySum="+...
0
votes
1
answer
594
views
Fail to redirect log to /var/log/syslog
I have an upstart script that does the following
start on runlevel [2345]
stop on runlevel [06]
respawn
pre-start script
exec >/dev/kmsg 2>&1
[email protected]:blabla/bli
...
0
votes
0
answers
474
views
How to check via bash if your connection is wireless N/G/... on Linux?
iwlist scan shows me the available wireless connections. I can see Frequency:2.412 GHz for the channel I'm connected to.
This article shows that a frequency of 2.412 GHz means that you are using ...
0
votes
1
answer
270
views
Bash delete file when variable = x
I'm creating a bash script which reboots the system at each reboot it adds a new line to a text file, I then read the text file before each reboot. Once the variable holding the number of lines ...
0
votes
1
answer
383
views
Why isn't `uptime -s` output constant?
I have 6 Raspberry Pi 3. A Bash script works on 5 of them, not on 1.
I use uptime -s > file1 [or -p, tried both] then later I cp file1 file2 at the end of my script.
The next time I run the ...
0
votes
2
answers
121
views
Setting terminal type in inittab file
I've set the terminal type to monochrome one in inittab file like so:
c2:... tty2 linux-m
but when I type a command with colored output like:
ls --color=always -l
I still get colored result. How ...
0
votes
2
answers
528
views
bash and function to detect duplicate data
In this example, I mention that I have 2 lists.
list1
x;00:26:82:50:00:00;192.168.1.195;COMPUTER1
x;00:26:82:50:11:11;192.168.1.195;COMPUTER2
x;00:26:82:50:22:22;192.168.1.196;COMPUTER3
list2
x;00:...
0
votes
1
answer
480
views
show duplicate data with awk print $2,$3,$4 in a single line
If I have a 2 lists that contain the following (examples):
list1
x;00:26:82:50:00:00;192.168.1.195;COMPUTER1
x;00:26:82:50:11:11;192.168.1.195;COMPUTER2
x;00:26:82:50:22:22;192.168.1.196;COMPUTER3
...
0
votes
2
answers
4k
views
How to configure network connection IP and DNS with script
Once a week I work from a specific location where I need to plug in my cable and configure connection to be connected to internet. Here are steps that you have to do:
You have to enter specific IP ...
0
votes
1
answer
2k
views
how to find and delete multiple files in bash/linux
I have directories with sub directories containing .srt files. I need to go through the directories and delete them all. I know how to find them like so:
find ./directory -name *.srt
but I'm not ...
0
votes
2
answers
893
views
How to save output of bash whilst preserving colored text?
When I use some command in bash like npm audit, I can see the output with some colored text.
I want to save the output with colored text preserved.
I have tried selecting the text and saving in ...
0
votes
3
answers
1k
views
Change Python version a script is referring to
I have downloaded the script "install_esoreflex" (ftp://ftp.eso.org/pub/dfs/reflex/install_esoreflex) and then execute the following commands:
chmod u+x install_esoreflex
./install_esoreflex
I get ...
0
votes
1
answer
184
views
Script for deduplicating files and folders with a particular suffix
A botched OneDrive restoration has left me with many files and folders with a " (1)" or " (2)" suffix.
I would like a script (Bash is fine as I have MinGW + Cygwin, or PowerShell) that would parse ...
0
votes
2
answers
267
views
Possible in bash? Turning command expansion into arguments
Are the only options for bash command expansion:
unquoted $(..) whose output is always parsed with dumb string splitting, or
quoted "$(..)" whose output is always passed along as a unit?
I'm ...
0
votes
1
answer
700
views
How to print all libraries in directories which use shared library?
How to print all libraries in directories which use shared library (mylibrary)?
I tried:
ldd /usr/mt-60/apl/651/*.so |grep libmylibrary
But output is without library names:
libmylibrary.so =&...
0
votes
2
answers
1k
views
How can I change the text after the @-sign in my terminal? [duplicate]
How can I change the text after the @-sign? I don't know what it means.
It says DESKTOP-HMEEP40.
0
votes
1
answer
51
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
1
answer
11k
views
How to stop git-bash shell from waiting for process to finish?
Based on a solution to How do I open a new git bash terminal window at my current location in windows? I can use
$ git-bash
to launch a new terminal from inside a git-bash console window.
However, ...
0
votes
2
answers
342
views
linux bash - can I create a shortcut (similar to windows) instead of a symbolic link?
so lets say I start here:
/home/user1/$
I want to make a shortcut to /tmp/subdir1/subdir2/here
Normally I would make a sym link:
/home/user1/$ ln -s /tmp/subdir1/subdir2/here here
Then I can do:
...
0
votes
1
answer
4k
views
Hiding your password when typed as an argument into a bash shell / command prompt?
I was using weechat when I noticed that if I do a command in the program like /msg IdentServ identify <my-password> that it actually blanks out your password as you're typing it...see image ...
0
votes
1
answer
845
views
How to exchange two patterns in place with `sed`?
I am using sed command to change <active>true to <active>false in an xml file. Now if I use
sed 's/<active>true/<active>false/g' file.xml > file.xml
it completely erases ...
0
votes
2
answers
1k
views
Mac OS X: growlnotify doesn't work when script is run from Quicksilver
Say I run the following script that includes growlnotify.
#! /bin/bash
# do something ...
echo 'I want growlnotify to say this' | \
growlnotify -a '[Some Application]' 'Growl Headline'; \
exit;
...
0
votes
0
answers
158
views
Trying to track a PID in windows created from the pub command
I am doing some Polymer and Dart development, and when I am running the server, i run pub serve in order to spin up the server. The issue is that to stop the server, i need to break out of it <...
0
votes
1
answer
151
views
How can I compare and delete duplicate files between multiple folders on El Capitan?
I'm dealing with two different types of file on OS X El Capitan. They have the same file extension but have tags at the end of the file name (e.g., abc123_m.psarc and abc123_p.psarc). I have one ...
0
votes
0
answers
1k
views
GNU screen - open new window in working directory of current window in a named (sessionname) session?
In order to open a new screen window in the same directory as the current working directory of the screen window you are launching it from (rather than the directory you initially launched the screen ...
0
votes
1
answer
1k
views
Needing to open OS X bash script as via launchd IN a terminal window
I've got a lengthy and complex bash script which works OK, but I'm trying to automate my deployment process and I'm flummoxed at this point.
I can get the script to run as a LaunchAgent no problem, ...
0
votes
1
answer
240
views
How can I alias a binary dependent on the machine I am on
I work on different machines, some as centos7, some are centos6, I build a binary tmux with a different version on each 'type' as the same version cannot runn both.
How can I tell my .bashrc to ...
0
votes
2
answers
2k
views
Is it possible to open a second shell session that will remember the user, machine, and directory I am in?
I'm ssh'ed into a machine and logged in as a different user. Is it possible to open a few new windows that will still be ssh'ed into that same machine, still logged in as that user?
-1
votes
1
answer
1k
views
Changing TERM variable and color output
I've set the TERM environment variable like so
export TERM=linux-m
to switch to non-color term. Now when i issue ls -l i indeed got no color output, but when i use for e.g: grep --color abc 1.txt it ...