A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

3
votes
1answer
823 views

How can I run an AppleScript or shell command on Mac OS X at screen unlock?

Note that this is not the same as startup or login. I never log out of my machine and I want to run the script whenever I unlock the machine to start working.
3
votes
1answer
503 views

Messy output in zsh working in emacs M-x shell

I have changed my shell to oh-my-zsh, which is working great in iTerm. However when I open up my Emacs, M-x shell, I see it also changes to zsh, but the output from executing commands is messy: ➜ ...
2
votes
1answer
52 views

What's the difference between dd and cat for writing image files?

When writing image files to disk or to a USB stick, the instructions usually use dd, like this: dd if=myimage.img of=/dev/sdb How is this different from, say: cat myimage.img > /dev/sdb I ...
2
votes
1answer
48 views

Execute command after broken SSH connection

Is there a way to execute a command after an SSH connection is broken (blackout etc.)? When I normally log off I can just use .bash_logout but I don't know what to do when my connection breaks.
2
votes
1answer
31 views

My host offers SFTP only, not SSH. Can I still use private key authentication? i.e., does SFTP use SSH implicitly?

I'm using WP Engine as my host. They are a managed host and they never offer shell access. However, they do allow setup of SFTP accounts. My (limited) understanding is that SFTP still uses an SSH ...
2
votes
1answer
27 views

Wrapping `time` (and similar keywords) in call from another script

I have a Bash script (let's call it clock) which should work as a wrapper similar to the time keyword in Bash, e.g. clock ls should do something and then run ls. Here is an example of this script: ...
2
votes
1answer
167 views

Command Not Found When Executed via PHP shell_exec()

I want to execute following command on my Ubuntu server using php: android create project --target 8 --name $fname --path ./$fname --activity MainActivity --package $fpack 2>&1 The above ...
2
votes
1answer
119 views

Is there a Unicode-aware LC_COLLATE sort order which respects punctuation?

As far as I can tell, setting the environment variable LC_COLLATE=en_US.utf8 changes four things compared to LC_COLLATE=c, regarding how programs like ls will sort files: Unicode characters are ...
2
votes
1answer
86 views

In bash 4.3.27 “su” ignores user variables when combining “-” with “-c command”?

Since forever we used to launch user scripts from a different user crontab like this: 00 12 * * 1 su - user2 -c "/home/user2/myscript.sh" By doing this, the script is launched after the interactive ...
2
votes
1answer
382 views

How to get a shell prompt in NX?

I have installed nxserver on a ubuntu machine and am able to connect to this machine via the free NX client on a windows machine. Things seem to be working fine except that the xterm has a weird NX ...
2
votes
1answer
256 views

Error “Insecure world writable dir /Volumes/BOOTCAMP in path, mode 040777”

I tried the answer sudo chmod go-w in my /Volumes/BOOTCAMP but I'm still getting the warning It says Insecure world writable dir /Volumes/BOOTCAMP in PATH, mode 040777 And when I echo $PATH ...
2
votes
1answer
446 views

Echo string in tcsh with special characters escaped

Is it possible to echo out a string in tcsh such that it is fully escaped, as tcsh would understand? In the same way as printf %q works in bash: % # Create a variable containing a tab character % ...
2
votes
1answer
739 views

SSH Session Started from Here Doc Does Not Exit Properly

SSH session doesn't terminate and give the tty back when executed inside a here document. Below is the code snippet that's inside my shell script: ssh -t -t root@$HOST_ADDRESS <<TERM_STRING cd ...
2
votes
1answer
80 views

Set timeout on zsh autocompletion

I like ZSH's autocompletion feature, but often it hangs my terminal. I'd like to set timeout on autocompletion so it cancels (kills) itself after n miliseconds.
2
votes
1answer
2k views

Cygwin runtime errors (“couldn't allocate cygwin heap”)

I am getting following exceptions when I start running some commands in Cygwin. C:\cygwin\bin\bash.exe (4136): *** couldn't allocate cygwin heap, Win32 error 0, base 0x740000, top 0x755000, ...
2
votes
1answer
1k views

Tab Auto-Completion in Mac OS X when using sftp in terminal

i have been getting very frustrated lately since the readline functionality has been removed from MacOSX and Tab Auto-Completion doesn't work anymore. So i was wondering if anyone knew a good ...
2
votes
1answer
310 views

windows “open command window here” gives wrong environment

I often use the right-click "open command window here" feature of Windows-7, but just found a problem where the environment it gives is different than what I get on running cmd from the start line, or ...
2
votes
1answer
729 views

Replace bash shell with python program's cmdline interface

I have a program which uses python's cmd module for command line interfaces. Now I want it to run on my Linux server whenever any normal user logs in to it, in a way that user never gets the default ...
1
vote
1answer
13 views

Upstart: What is the first tracked PID w/o expect, but with script AND exec?

I have some Upstart configs used to start some foreground and blocking processes to run in the background as some kind of "daemons", especially those processes do not fork in any case. What I want is ...
1
vote
1answer
14 views

Keyboard command in shell for skipping file during copy

Probably a stretch but is there a keyboard command that is accepted by cp from the shell (using bash/zsh) to skip a currently copying file for example if I am recursively copying a folder structure of ...
1
vote
1answer
45 views

Standard utility to write stdin to a file with no stdout?

I have two cases where I want to create a file with its contents supplied on standard input: I need to use sudo to have the privileges to create a file. An application always invokes an ...
1
vote
1answer
11 views

A cron job to change file permisssion

when i run chmod 777 to change permission of a file manually it runs. but when i put it in a cron job, it never changes the permission. #!/bin/bash YESTERDAY=`TZ=aaa24 date +%Y-%m-%d` chmod 777 ...
1
vote
1answer
26 views

Monitor SSH login's via slack but hangs on SCP

I'm playing around with some slack integration so that every SSH attempt gets sent to a slack channel The script below works perfectly for SSH attempts but the issue is that when I preform a SCP to ...
1
vote
1answer
30 views

Hit enter automatically when running apt-get install <package> prompts a dialog boxes

I'm running command apt-get install -y <package>. It overcomes confirmation like Do you want to continue? [Y/n] But in the process of updating, I got a popup which asks to hit enter in ...
1
vote
1answer
35 views

Why can't I use my newly created user with chown?

So I am attempting to create a new user and group, and then change ownership of a directory to that new user/group. However, when I do, chown comes back with an "illegal user name" message. Here's a ...
1
vote
1answer
63 views

How to run elevated shell from within console2 (Windows 8.1)? Possible?

I come from Linux, and for days I have been pulling my hair out trying to run an elevated shell (powershell, ipython interpreter, and bash) from within Console2. However, it always pops open a new ...
1
vote
1answer
28 views

Custom Windows shell hosted on the network

We have a custom kiosk-style executable that we are using as a shell on Windows 8.1 machines. We'd like to host it on the network so that it's easy to update as desired. The problem we have is that ...
1
vote
1answer
80 views

Can't find the good Cygwin shell executable

I am working on Windows 7 and I need Cygwin for my project. I am trying to launch the Cygwin terminal from a Java programm and then write command lines but my problem is that I can't find the right ...
1
vote
1answer
123 views

Starting Zsh in ConEmu in specified directory

ConEmu runs zsh under CygWin fine. I want to add a right click option to explorer to "Start ConEmu With CygWin Zsh In This Diretory" ConEmu provides an Integration settings page to set explorer ...
1
vote
1answer
29 views

Shell Script unable to execute passed command as input

I am trying to execute command from script but unable to execute it. script :command.sh #!/bin/bash a=$1 b=$2 echo "a=$a" echo "b=$b" `$a | $b` Execution command : bash-3.2$ ./command.sh "tar ...
1
vote
1answer
29 views

How to create filename.tar.Z file on SunOS operatting system

I am trying to create filename.tar.Z file using single command on SunOS but it doesn’t seem to work: bash-3.2$ tar c DIR | compress >DIR.tar.Z tar: /dev/rmt/0: Permission denied bash-3.2$ Other ...
1
vote
1answer
90 views

Linux unzip: don't prompt user

I need to unzip a file in my nodejs script: var exec = require('child_process').exec; var execOptions = { timeout: 15000 }; exec('bash unzip.sh', execOptions, function (error) { ... }); In ...
1
vote
1answer
127 views

WinRar - Custom shell commands

i'm trying to create custom commands on the context menu in windows. i found this great registry hack here: https://superuser.com/a/376879/395548 this is the code made to work for me: Windows ...
1
vote
1answer
74 views

Tar not preserving permissions on extract

I'm backing up a users folder as root using tar tar -czf /mnt/disk/cloud.tar.gz -C /home/cloud/ . In /mnt/disk I do a test tar ztvf cloud.tar.gz and it shows -rw-r--r-- cloud/cloud 14 ...
1
vote
1answer
602 views

What is the difference between set, env, declare and export when setting a variable in Linux shell?

What is the difference between set, env, declare and export when setting a variable in Linux shell, like Bash?
1
vote
1answer
38 views

Different globbing behavior with same shopts?

I have multiple shells (bash) open on the same machine, and in one of them, globbing seems to have stopped. ls * gives ls: *: No such file or directory, and so on. I figured that I must have set some ...
1
vote
1answer
63 views

realpath (GNU coreutils 8.22) does resolve “.” symlink regardless of “-s”

I'm trying to use realpath in a script which has to ensure that it is located under a certain (possibly symlinked) path. Also the script has to be runnable from any location, so it cannot presume that ...
1
vote
1answer
32 views

Is it possible to sed -i from a text file to another text file?

I'm coding a shell script on my Debian box and there's a line on the script that needs to delete some emails from a textfile that is full of emails, like this: sed -i ...
1
vote
1answer
138 views

error handling in case sentences [Shell Script]

I have this setup and I need when an error happened in the main script, to take this error to a $INFO_PLUGIN temp file, the problem is the script continues working after case and send also an OK ...
1
vote
1answer
23 views

Forwarding shell to servers without installing it

is there any way how to forward a shell to a server without installing it on that box? This is what I need to do: I work for company where we admin X boxes and I will probably not be allowed to ...
1
vote
1answer
26 views

Building a String of dynamic length - least consuming way?

I want to write a series of the character -, the amount equaling to 50% of the terminal window column size. I already have the column size. Let's say the terminal column size is 30. My desired end ...
1
vote
1answer
468 views

Sending Linux commands over serial connection to an Android device

I have a question about being able to send Linux commands over a serial connection to an Android device. I have heard of PuTTY and tried to use it, but I am ultimately lost with it. I was in the ...
0
votes
0answers
76 views

Can someone put some restriction to copy few files from folder by root in linux

I have the backup script where i was making the tar backup of directory everyday. ON friday i note that my filesize was 30MB but beofrethat it was 200MB. I checked the main folder and it was around ...
0
votes
0answers
152 views

Boot directly into application when power is cut

I have an application that I replaced the windows shell with so that windows would boot directly into the app instead of loading the desktop. After doing some testing I found that windows doesn't boot ...
0
votes
0answers
233 views

Nano (pico) editor window resize

I am still not sure what I have done but I was testing some button combinations when I was in nano editor and all of a sudden the contents of the window started not to adjust themselves when I resized ...
0
votes
0answers
747 views

Shell script to copy a text file from windows machine to linux based device

A linux based navigation device is connected with my windows machine. I want to copy a text file to root of device using shell script from windows machine(through cygwin or putty). please help. ...
0
votes
0answers
645 views

How to recover a directory that was corrupted to a 32kb file?

I am trying to recover a 200 GB directory that was accidentally lost and "converted" to a 32kb file. It was on a FAT32, 500 GB external hard drive. Only this folder got corrupted, on a Windows ...
0
votes
0answers
743 views

How to make a Shell Script create a copy and terminate itself?

So far I used trap " call function" 2 fucntion { ./test.sh exit } but it never reaches the exit line and a whole bunch of process piles up any one got any idea? I tried & (bg) but i need to ...
0
votes
0answers
447 views

user crontabs don't work, only /etc/crontab

Hi when I use the command crontab -e to set up cron, the commands get triggered (according to syslog) but nothing happens. Also if I run sudo crontab -e. The only way to actually get cron working ...
-3
votes
0answers
34 views

How to write a shell script output to an XML file

I want to write a Shell script output inside a value in a XML File as shown in the following example: Assuming initially the line inside the XML looked like this (with number 4 inside) ...