The shell is unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …).

learn more… | top users | synonyms (1)

5
votes
0answers
103 views

Peculiar Solaris integer comparison behaviour

This one caught me unawares! We have a Solaris machine (version: SunOS 5.8) hosting a pivotal script/process which has been running for many years without complaint. We recently had cause to have a ...
4
votes
0answers
236 views

How do I execute in background / return early?

For reference, I'm using phpseclib to control a remote SSH server using the 'root' account. I have to start/stop a java process which is ran in the background. Stopping works fine with killall java ...
3
votes
0answers
21 views

cursor and combining diacritics in shell

I frequently deal with combining diacritics, especially the combining acute accent (U0301, or \xcc\x81). I have a keyboard set up to insert this character, and that works fine in the shell. $ echo а́ ...
3
votes
0answers
74 views

List all btrfs filesystems and subvolumes in shell

Is there a convenient way to get information on all btrfs filesystems subvolumes without resorting to C, i.e. in POSIX shell ? /sys/fs/btrfs contains info only on filesystems, nothing on subvolumes, ...
3
votes
0answers
124 views

What default shell to use for an SSH user limited to a single command

When limiting a user to a single command via ssh, what default shell should be used for the user? This is a follow up to how can shellshock be exploited over SSH? I have a machine that is running an ...
2
votes
0answers
14 views

restrict private apt repository with rssh - why does apt-get try /bin/sh?

I am trying to set up a private repository via ssh. My sources.list.d/ contains the entry deb ssh://user@host:/repo ./ user is a certificate only account on host. apt-get update works fine. ...
2
votes
0answers
81 views

Where EOF character is processed when it sent over telnet connection

Lets suppose I am connecting to telnet server, where bash is running. I am executing comand "cat > /tmp/qqq"; typing some contents of a file and finally sending 0x0a 0x04 which meant EOF. The ...
2
votes
0answers
61 views

Higher-level wrapper for entr or inotifywait

I'm looking for a way to rerun a specific command as soon as any of the files in a subdirectory (perhaps minus selected excludes) changes. Use case I'm working on a project that is self-contained in ...
2
votes
0answers
71 views

A way to distinguish between interleaved output from two background processes

If I have two backgrounded processes that produce input to STDOUT or STDERR (e.g., two installation scripts), is there an easy way to make these two output streams distinguishable? I guess I can pipe ...
2
votes
0answers
97 views

“Restart” a process in the same terminal?

I put "restart" in quotes because the following question on SO illustrates what I'm trying to do: http://stackoverflow.com/questions/27957091/restarting-a-process-in-the-same-linux-terminal I'm ...
2
votes
0answers
51 views

How to get the mplayer's single-line playing progress info?

mplayer shows and refreshes a single-line playing progress when playing a media file. A sample result is: A: 17.2 (17.2) of 213.0 (03:33.0) 0.5% And I'm trying to grep this playing progress and ...
2
votes
0answers
63 views

Is there a difference between double quoting a variable or a whole line in echo

When you type, for example, echo Variable "$var" is not initialised. and echo "Variable $var is not initialised." the front end result is the exact same (as far as I know, at least). But I was ...
2
votes
0answers
83 views

Read output in `screen` from outside

Suppose I opened up a screen to run some program that outouts some result. Once the program finishes, is there a way to get the result in the screen from outside. For example: I opened up a screen ...
2
votes
0answers
114 views

How can you get the current terminal line (the one that is still editable by the user)?

I need a way to use the current line which the users typed into as variable for a shell function. my current code, which can be called by ctrl+r zle -N search bindkey "^R" search search () { read ...
2
votes
0answers
361 views

How to pass multiple commands via pssh and multiple xterms

I'm attempting to open multiple xterms and run a command as an SAP user via sudo using pssh. So far, I'm able to run PSSH to a file of servers with no check for keys, open every xterm in the servers ...
2
votes
0answers
413 views

How does SELinux / SEAndroid prevent or allow pseudo terminal allocation?

I'm trying to resolve an SSH connection issue on an Android phone running SELinux in "Enforcing" mode. The problem is that any SSH connection that tries to allocate a pseudo-terminal (/dev/pts etc) is ...
2
votes
0answers
113 views

Segmentation fault with dialog

I'm getting a segmentation fault with the following script when it's more that one child dir past the pwd. The program kills with the error message and I have to reset the shell. For example: I start ...
2
votes
0answers
140 views

zsh: Echoing every statement?

I have an odd problem with zsh when I switch between shells in a particular way: Option 1 (works well): I start a zsh shell. I switch to tcsh with /bin/tcsh, and I switch back to zsh with /bin/zsh ...
2
votes
0answers
369 views

What happens when you background a function which calls another function?

Question says it all on the tin. Can someone explain to me what goes on here ? I'm trying to find out how to background a process in a script that calls another function and reliably terminate it when ...
1
vote
0answers
18 views

External monitor script has become unreliable

I have been using the following udev rule and bash script to automatically configure my external monitor for some time now, however recently the script has become unreliable, usually doing the ...
1
vote
0answers
7 views

Global [multiple sessions] directory stack

For the current zsh session I use dirs -v command to print the directory stack. I'd like to have an analogous tool that shows me the directory stack of all sessions, also the closed ones. Or if not a ...
1
vote
0answers
18 views

Write shrunken .img file to device file

I have a backup image of a device file /dev/sda3 that I created using: dd if=/dev/sda3 of=~/sda3.img. The image is very large, so I have re-sized it to remove empty space. My question is can I ...
1
vote
0answers
53 views

Recording shell output for interactive commands

While looking into a shell redirection problem, I found a couple of answers that pointed me to the script command. As I understand it, script just records in- and output of the terminal, and allows me ...
1
vote
0answers
34 views

csh: How to save the shell environment (env, current dir, shell history) in a file and set it on another shell?

I start interactive terminal using farm (LSF). These terminals get opened on some random host and get closed automatically after 15 days. I want to save the current shell environment (env, current ...
1
vote
0answers
74 views

Easy way to compare BIOS information between two machines?

I have two machines - machineA and machineB running Ubuntu 12.04 Is there any easy way I can compare BIOS settings between those two machine and see the difference instead of doing it manually using ...
1
vote
0answers
28 views

Is it possible to create aliases that affect services starting?

Currently I have a custom service that executes java in multiple places. I want to be able to add an option to any executions of java this service will spawn (I'm specifying the error log location, ...
1
vote
0answers
83 views

Shell Script to change user shell

I am writing a script that would be invoked to change user shell. The basic requirement is that once user gets authenticated (e.g: thorough some web application) the script would be invoked to set the ...
1
vote
0answers
39 views

Setting custom baud rate on console

Just for aesthetics I would like to have my text on my console be displayed at a lower speed. I've tried using things like screen with custom baud rates of /dev/tty1 but it wouldn't work, input from ...
1
vote
0answers
90 views

Sed regex printing into a file.txt

I'm connected to a MQTT stream, and I filter out the data by entering : mosquitto_sub -d -t +/# 2>&1 | sed -n "/PUBLISH/{s|.*\('.*',\).*|\1$(date),|;N;s/\n//;p}" into the Ubuntu terminal. ...
1
vote
0answers
91 views

What is the meaning of the string **/* when used with grep?

I came across this picture (below), obviously it is a pun or some kind of allusion incorporating command-line expressions. Frankly speaking I do not understand anything of it except for grep -n. ...
1
vote
0answers
89 views

gdrive -bash: /usr/bin/drive: cannot execute binary file

I am processing hundreds of image files on a weekly basis and gdrive would be perfect for automatically making duplicate copies of the raw images for archive before the originals go through the ...
1
vote
0answers
32 views

optimisation of bash globs

Looking for a guide to optimising regexp matches in bash. I have a script that loops over a very long list of URLs looking for patterns. Currently it looks a little like the fragment below. Is there ...
1
vote
0answers
108 views

pkill -P $ID working while kill — -$ID not

I was playing around with creating and killing process groups on linux ( ubuntu ) I am trying to kill a process group and am being driven crazy by the fact that pkill -P $ID works while kill -- -$ID ...
1
vote
0answers
602 views

Cannot add startup service to openWRT from init.d

I have openWrt installed on a TP-Link TL-WA901N/ND v3. I don't have luci package installed because I don't have enough space, so I can only do thing via cli. What I'm trying to achieve is to create a ...
1
vote
0answers
313 views

Cannot SSH after switching to Netgear router

I have Comcast Xfinity internet. When I was sent their Wifi router/Cable modem combo box, I was able to use SSH perfectly. However, since the Wifi from the box was weak, I decided to buy my own ...
1
vote
0answers
834 views

Load a background image or set the background color if Konsole/Shell is running SSH

I want to set my laptop to load an image in the shell's background or set the background color to red if I'm connected via SSH. How can this be done? With a bash function in .bashrc? I have: Set the ...
1
vote
0answers
285 views

How to start a process chain from the shell

Is it possible and if so how do I: Start a /bin/bash process that is not bound to a terminal from a terminal? Hence, a shell process that shows up in the process tree as init -- bash. (Shells ...
1
vote
0answers
155 views

Chrome OS: Crosh Window and Hostname

I have a couple of questions regarding Chrome OS: By default Ctrl+Alt+T opens a crosh window within the Chrome browser. I have the Crosh Window extension, which I would like Ctrl+Alt+T bound to - ...
1
vote
0answers
217 views

Measuring context switches of a LWP gives incorrect results. Why?

I have a Java thread pinned at my cpu core. It is busy spinning and I see through top that it is running fine: %Cpu0 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st %Cpu1 : ...
1
vote
0answers
111 views

Execute commands on TMUX Detach

Is it possible to execute commands on tmux detach? I usually have a rails console and server running in the tmux session, on detach is it possible to automatically end those? Thanks.
1
vote
0answers
60 views

Merge several files with maximum 1 line difference

Suppose I have the following files: file0.c: int b=NULL; int a=NULL; file1.c: int b; int a=NULL; file2.c: int b; int a=NULL; I am looking to merge the files file1 and file2 to generate the ...
1
vote
0answers
506 views

Using node.js and shelljs as interactive shell

Following the answer given at unix.stackexchange.com/questions/58011/is-there-a-javascript-shell That requires me to always execute var shell=require("/usr/local/lib/node_modules/shelljs"); It ...
1
vote
0answers
283 views

Serial Communication on DD-WRT stty config not sticking

I am attempting to control a serial device (in this case a projector) using a Fonera router with DD-WRT on it. I've got the serial port on the fonera wired through a level shifter and then into my ...
1
vote
0answers
395 views

gnome-terminal cmd leaving processes open after closing parent window

The following simple command should demonstrate my issue: gnome-terminal --tab -t "Tab 1" -e "/bin/bash" --tab -t "Tab 2" -e "/bin/bash" This should open a new window with two tabs and an active ...
1
vote
0answers
781 views

service command: Failed to issue method call

I downloaded the source of tinyproxy and then use ./configure make make install to install it Then I want to start it, but get errors, like the following: [root@kitty tinyproxy-1.8.3]# service ...
1
vote
0answers
104 views

add audio from playing file to microphone stream

I need to add a sound to what the microphone is capturing, is it possible? I started with man aplay and found that I can do aplay -D PCMdevice filepath.wav so then I listed the PCM devices with ...
1
vote
0answers
33 views

Make zkbd ignore $DISPLAY

Is it possible to make zkbd ignore $DISPLAY variable? I have set up when I log in to different X sessions and it is annoying if suddenly I need to reenter/copy configuration (and I have no idea why ...
1
vote
0answers
171 views

(KDE or X ) Script opens konsole in wrong virtual desktop

I have this script. I put it in ~/Desktop. I view the script on my desktop in a "Folder View" widget. When I click on the script, I get list of users, then I get an authorization dialog box ( for a ...
1
vote
0answers
538 views

Manually setting environment variables for Metasploit

How do I set manually environment variables for Metasploit, when I execute db_driver I get this message: [*] No Active Driver [*] Available: [*] DB Support: Enable the postgresql driver ...
0
votes
0answers
27 views

How do I send a variable through SSH so it can be used across servers? C Shell

EDIT: Would this be possible in bash? Note: I have to use C shell. (.csh) I have something very similar to the following code: set var = "string" ssh -X server "$var" << END * I ...