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)

7
votes
0answers
226 views

regarding portable sed -e… d b or ! b?

In this edit Stéphane Chazelas POSIXifies (again) my sed formatting by inserting an -expression break and another -expression statement. Now, I might just ask him why in the comments, I suppose, but ...
4
votes
0answers
123 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 ...
4
votes
0answers
80 views

Tracking my shell path in Emacs

Not a long time ago, I found the following precious snippet that allows Emacs to track my current directory on any ansi-term buffer. More specifically, if I cd <some/path> from within a ...
4
votes
0answers
111 views

weird output when typing letter c in shell (non english input)

I had keyboard set to Georgian language input. Forgot to switch it back to English and typed letter c in shell. c = ც english c key is mapped to georgian letter ც - if this makes any difference. ...
3
votes
0answers
54 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
56 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
78 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
180 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
266 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
114 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
295 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
32 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
83 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
193 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
237 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
82 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
132 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
69 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
52 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
76 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 ...
1
vote
0answers
369 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
188 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
322 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
395 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
70 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
30 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
133 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
440 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
21 views

How to disable “Warning: Program '/bin/bash' crashed” message?

I'm using Kubuntu 14.04. When I exiting terminal emulator (konsole or yakuake) by doing something like kill -9 $$ it doesn't close, and saying: Warning: Program '/bin/bash' crashed. How could I ...
0
votes
0answers
34 views

Socat execute commands on remote

I am playing around with socat and wanted to execute commands to hosts that connect to my IP PORT running socat. In this case I am trying to dump a file on localhost and this is how I am trying to ...
0
votes
0answers
31 views

Extracting trace information using gawk

I am new to awk programming and am using gawk to extract trace information from a mrt file in order to use it further for analysis. I have successfully been able to extract trace information from a ...
0
votes
0answers
14 views

od: Put offset n to n of a hexdump to a file in proper hexdump -C (hex+ASCII) format

I have a 155GB canonical hex+ASCII hexdump hexdump -C blah > dump.dp Then ran: strings dump.dp | grep -bo 'XXXX' > found.txt So now, that file contains the string's hex offset in the ...
0
votes
0answers
70 views

Why isn't this `expr … | bc -l` command working?

I'm noticing an error: bash: syntax error near unexpected token `-105.5*7+50*3' When executing the below script/expression: expr (-105.5*7+50*3)/20 + (19^2)/7 | bc -l Is there any other way ...
0
votes
0answers
28 views

route -n gives output “route: fscanf”

If I boot my system and no interface has an IP address I get the above output. However if I give an interface an IP, even if I remove it again, this will disappear. Why does this happen? Is it that ...
0
votes
0answers
47 views

Unix Shell script to delete all traces of itself after execution through crontab

My Question has 2 parts. Help with both parts is greatly appreciated. GIVEN INFO: - Lets assume there are 2 Folders, Folder A and Folder B. - Folder A contains many files. - Folder B contains the ...
0
votes
0answers
39 views

How to decrease the RAM and Cores for sometime

I have 9 VMs running Ubuntu 12.04.I am using resources from GENI ( Global engineering Network Infrastructure ) to set up topology and i reserved resources with the following configuration. RAM - 4GB ...
0
votes
0answers
95 views

Making A Shell Script To Write To XML File

I am writing a shell script to make writing my RSS a whole lot easier. Right now I am stuck at how to properly edit my files. See, I want the program to take in data from me, and then save those to ...
0
votes
0answers
39 views

How to get diff for HTML reports?

echo "New defects" echo "===============================" n=0 def_num=0 while read line; do n=$((++n)) if echo $line | grep '^[[:space:]]*>' &>/dev/null; then if [ $(($n % ...
0
votes
0answers
150 views

Detach a process from Sh (not Bash) or “disown” for Sh (not Bash)

Consider a shell script executed by Sh, not Bash (and I can't change it, and can't use a shebang, it's ignored). The & operator works, but disown $! does not and makes Sh complains “disown: not ...
0
votes
0answers
74 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 - ...
0
votes
0answers
55 views

How to return multiple select count in an array variable in shell

I have a 4 SQL count values which I want to return in an array record_count so that I can use that count values in some if statements later in the shell program. But I am not able to return the values ...
0
votes
0answers
51 views

Virtual serial port problem

Background: I've to test external GSM module, connected to PC with serial port. Since I'll have to either send messages both to do more, I need to create two virtual serial port (script provided by ...
0
votes
0answers
50 views

Use FindBugs in Eclipse from terminal on Ubuntu

Is there any way I could use Findbugs from terminal to get all the bugs in my Java code and print it out to a text file? I want to write a script that goes through 100 java files ( this is already ...
0
votes
0answers
104 views

Specific Jar file doesn't run on startup

I want to run a jar at startup, so I asked a question here. I was given a few suggestions, so I started from trying to create a script file and desktop file. I created a script file and desktop file ...
0
votes
0answers
31 views

convert many eps files in a single pdf or ps file using shell scriptI

I have SSt12.OLR.1.eps, SSt12.OLR.2.eps SSt12.OLR.3.eps SSt12.OLR.4.eps ......and covert these eps files into single pdf or post script file. please suggest a shell script.
0
votes
0answers
132 views

How to format xml attributes, not just elements

How do you format an XML document to make it easy to read element attributes? I have a xml based webservice that returns one or two elements, but with hundreds of attributes. As I'm doing ...
0
votes
0answers
36 views

Convert rgba color value to a Terminal supported color

Randomly I will take the following example: rgba(122, 143, 186, 0.54) How can I convert this color to the closest Terminal supported color?
0
votes
0answers
109 views

usermod -L after creating the home dir

so I see from some questions here, to lock an account, create it, then lock, e.g. useradd -M lol;usermod -L lol However.. I do have a home dir, by eg. useradd -md /path/lol Question is.. to avoid ...
0
votes
0answers
268 views

Override LDAP login shell for a specific user in RHEL

How in RHEL do I specify /sbin/nologin shell to limit a user to SFTP access only when their shell is determined by their LDAP profile? chsh only works with passwd file users I believe.
0
votes
0answers
80 views

Application does not see environmental variables

I am running following 32 bit command on 64 bit system: LIBGL_DEBUG=verbose glxinfo32 -v -t | head -5 It's output says direct rendering: No (If you want to find out why, try setting ...