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)

4
votes
0answers
172 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
87 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
131 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
73 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
29 views

Is there a nice way to set directory/project local environment variables?

I have been working on several projects and they require different environment variables (e.g., PATH for different versions of clang executables, PYTHONPATH for several external modules). Whenever I ...
2
votes
0answers
33 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
56 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
43 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
58 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
65 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
88 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
218 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
327 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
95 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
125 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
314 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
14 views

How to move directories based on the output of rhash (CRC32 check of .sfv) with bash/perl?

My idea, is to move the CRC-check OK folders (albums) into a lets say "complete+CRC_OK" folder with a script once per day in cron. I would need to put the rhash command in a loop with number of ...
1
vote
0answers
35 views

delete non important characters from command output

the version command in my Linux machines display the following output version Red.Hat.OS. release..........5.5 APP.Release.............4.2.0.0-02 how to remove the middle "." dot character ...
1
vote
0answers
68 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
61 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
34 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 ...
1
vote
0answers
35 views

Autocomplete issue in bash with equal sign (=)

I am trying to make autocomplete work and wroted a piece of code to demonstrate an issue I faced up: $ cat completion.sh function _completion_command() { compopt +o bashdefault +o default +o ...
1
vote
0answers
41 views

Cannot change bash shell in Mac OS X

I'm trying to update bash shell on my Mac OS Mavericks. $ brew install bash $ which -a bash /bin/bash /usr/local/bin/bash $ which bash /bin/bash $ chsh -s /usr/local/bin/bash $ which bash /bin/bash ...
1
vote
0answers
26 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
73 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
236 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
266 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
470 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
129 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
103 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
174 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
80 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
53 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
399 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
221 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
340 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
492 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
79 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
31 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
151 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
468 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
38 views

Shell splitting line into words without temporary file

yesterday I found out that this creates temporary file. Can anyone help me how to rewrite it so it wouldn't? I am desperate I have tried everything that I know, but it doesn't want to work. And also I ...
0
votes
0answers
29 views

Restrict FTP user to access only its own directory and Download Only

I need to create a user which can only FTP to specific directory and download data from it only no upload or delete files. After searching on line I reached to following points useradd -g 10 -d ...
0
votes
0answers
15 views

How to convert Ubuntu init script to Amazon Linux AMI init script?

I had a Ubuntu based Amazon EC2 server where I was running my java based application. For this I had written a init script which was running perfectly and as follows #! /bin/sh # set the environment ...
0
votes
0answers
21 views

Linux . Kali on android 4.2.2

hope this topic finds you well E: Unable to Locate Package thats the error that occur when i try to install any tool in kali on android I'm using Android with version 4.2.2 and kali is working well ...
0
votes
0answers
32 views

How can I disable FTP access/login for users

I want to temporarily disable the FTP Access of the FTP users I have tried following commands for user "aadmi" but still able to login sudo passwd -l aadmi which said Locking password for user ...
0
votes
0answers
52 views

'cp:cannot access file' error in script?

This is the code: #!/bin/bash $REPORT_PATH='/data/operational/logs' cp "$(`ls -t | head -1`)" "$REPORT_PATH/new_file" This gives error 'cp:cannot access pda_param'. pda_param file is o/p of ls ...
0
votes
0answers
23 views

convert from one memory format to another and find the difference between them

Using shell scripting, how can I convert from one memory format to another and find the difference between them? I want to compare current rate and previous memory rate (Where we need to compare ...
0
votes
0answers
12 views

sending NEDIT to background on launching

I have this problem - for opening nedit it will open in the foreground. Then either you open it using & ex- prompt> nedit & is there any way where I can open nedit directly in the ...
0
votes
0answers
34 views

checkbox to automated sql scripts run

I want to provide a menu in a shell script that offers a check list of SQL scripts to run. I actually need to execute the selected SQL scripts but it's about 20 of them and that make it hard to cover ...