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
2answers
227 views

How to execute a second condition if the first condition is true in Linux shell scripting

I have an if condition. If that condition is true then one script will be run and after that I need to check another condition. How can I do that using an if statement or something else? For ...
0
votes
1answer
13 views

Running the output of `ssh-agent` in fish; what does `setenv` do?

When I want to start (or restart) ssh-agent, it gives me a few commands that I should run by doing eval $(ssh-agent). Of course this fails for fish, since it gives syntax for bash or csh. The ...
-3
votes
1answer
29 views

Automatic start of processes in linux server if error found

please check below script . here "sanity" and "start" are the scripts . It will work ? please suggest > #!bin/bash > DATE=`date +%Y%m%d` > touch opt/logs_$DATE > sanity >> ...
1
vote
0answers
3 views

How to read contents of ATSAM3X8E chip on Arduino Due Board in Mac OS X

I have two Arduino Due boards with some programming that has since been lost. I need to back up the contents before replacing the program. I’ve been playing around with another Arduino Due before I ...
0
votes
3answers
38 views

Loop inside EOF - UNIX SCRIPTING

I am writing a script to automatic start up of an application whenever we found error in logs. so #/bin/bash if [ grep -c 'error' logs -eq 0 ] ;then exit else start <<EOF ## start is a ...
5
votes
1answer
63 views

Why does rsync read .bashrc and not .profile?

rsync is a non-interactive program that logs into other machines. It shouldn't need the init file for an interactive shell session, and it should absolutely need the init file for a login shell. Or so ...
-2
votes
1answer
25 views

using find and delete files/folder - with the exception of 1 folder - challenging

i want to use find and delete everything with the exception of one folder if found. e.g. [oracle@SJOAM test]$ ls -l total 4 -rw-r--r--. 1 oracle oinstall 0 Sep 2 02:05 a -rw-r--r--. 1 oracle ...
1
vote
2answers
32 views

“read” works as expected in ZSH but behaves differently when using any other shell

I’ve written a short while-do cycle but I found it working strange with different shells. That's it: find "`pwd`" -type d | while read -r D; do ls ${D}; done When I start it using zsh, all goes ...
0
votes
1answer
25 views

Bash script to create a folder structure

I'm trying to write a Bash script to automate a recurring task, namely the creation of a structure of folders, where some of them should be numbered (To be more specific, this is meant to archive some ...
1
vote
1answer
15 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 ...
0
votes
0answers
8 views

Running SGE array job

I am working on SGE and I want to submit an array job for 10 files. For the time being to keep it simple I want to use only 2 commands in the script for each input files So let's say I have 10 input ...
1
vote
0answers
13 views

How to set output of terminal to external VGA display

I have laptop with broken screen and external monitor that i can connect to laptop via VGA port. Is there any way how to set output of shell(I have no GUI on installed debian) to VGA monitor? I can ...
0
votes
0answers
16 views

How can I get new messages in thunderbird via linux terminal?

I am trying to find a way of getting new messages from Mozilla Thunderbird without opening it.
1
vote
3answers
30 views

How to scp-and-ssh with specifying host twice?

I frequently do this kind of thing: scp somefile me@host:/some/path ssh me@host Typing out me@host twice can be irksome. We (or at least bash) can grab that last argument with !:$, but that ...
-2
votes
1answer
37 views

bash: Loop over lines of a file

Here is my script: #! /bin/sh for line in $(cat list); do echo "[$line]: Getting my workers list.."; var=$line-"worker1"; echo "$var" >> "hostlistworkers.txt" ...
-1
votes
1answer
43 views

Enter shell script output in a Xml file

<property> <name>mapred.tasktracker.map.tasks.maximum</name> <value>2</value> <description>The maximum number of map tasks that will be run simultaneously ...
-3
votes
0answers
37 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) ...
0
votes
3answers
24 views

formatting output in bash shell to remove special characters - linux

I am issuing the command below against a logfile grep "Oracle Audit" /var/adm/messages | awk '{print $6}' How do I format the below output Audit[9460]: Audit[10507]: Audit[10507]: Audit[10507]: ...
1
vote
1answer
38 views

Incorrect output of history command of ssh. How to read the timestamp info correctly

I set the HISTTIMEFORMAT variable to store the timestamp info .bash_history file. I am able to display the history properly if I use interactive shell. But, when I run history command to display ...
0
votes
3answers
43 views

/etc/shadow and /etc/passwd privilege - why is it writable

sghk1> id uid=0(root) gid=0(root) sghk1> ls -l /etc/shadow -r-------- 1 root sys 4045 Aug 24 15:52 /etc/shadow sghk1> ls -l /usr/bin/passwd -r-sr-sr-x 1 root sys ...
0
votes
1answer
32 views

Change default shell on MSYS2

I want to change MSYS2's default shell from bash to zsh. I've tried chsh - not available in MSYS2. Editing /etc/passwd does nothing. It seems to be ignored. I took a look at the batch scripts in ...
0
votes
0answers
21 views

Undo command Linux “rm” [duplicate]

Please, I have used rm * in a script shell, it deleted all my files? (a typo) Is there a solution to recover these files ?
2
votes
2answers
76 views

Run tcsh with arbitrary startup script

I want to create a new instance of tcsh and source an arbitrary script, all in one step. The problem is that when I use the -c option, the shell instance closes as soon as the script is complete. ...
1
vote
1answer
44 views

How do I list all installed packages from the command line in bash / osX

What is the -bash command to list all the packages installed locally on my machine? I am using osX. I tried the following so far: dpkg -l - doesn't work. apt --installed list - doesn't work. ...
1
vote
1answer
22 views

How to run overdue at jobs

Sometimes I have at jobs overdue after system-suspend that don't run after waking up. How can I tell atd to run them? I tried atd -s or atrun but I guess that isn't meant for this as it doesn't run ...
0
votes
2answers
38 views

FFmpeg : mp4 and multiple srt into mkv

I have a couple of srt subtitle tracks for an mp4 video. How do I make them into mkv using ffmpeg/avconv? I would like to use space efficiently. Performing conversion on Darwin v13. I will be ...
0
votes
1answer
27 views

Why awk printing wrong string into the output file?

I'm trying to read file with awk and write the output in a new file. Content file sample: DATE_Login|09:01:20.507|2015-08-13|TIME_Session|00:32:32|MX|w32 ...
0
votes
0answers
25 views

shell script works normally, but not as a vagrant provisioning script.

I am trying to have vagrant run a script from within the provisioning script. pip install --upgrade pip sudo pip install virtualenvwrapper source /usr/local/bin/virtualenvwrapper.sh mkvirtualenv -r ...
1
vote
0answers
14 views

Terminal reset troubles

According to the MinGW setup program, I have the bash shell installed. When I attempt to issue a reset, I get: sh: reset: command not found Bash responds to the reset command in every other ...
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 ...
2
votes
1answer
34 views

Zsh shows debug information on startup

My zsh shell is showing some weird behaviour lately. Every time i start a new session these debug information are shown before my prompt: LC_CTYPE=en_GB.utf8 LESS=-R LOGNAME=username ...
1
vote
1answer
46 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 ...
0
votes
1answer
6 views

tmux server being killed when shell closes

Tmux server and my tmux sessions are being killed at the end of my SSH sessions. SSH session: # timepoint 0 $ tmux # timepoint 1 # ^D [detached (from session 0)] # timepoint 2 $ tmux a # ...
0
votes
1answer
42 views

why `./file.py` was working but `bash file.py` not work?

Why ./file.py was working, but bash file.py not work? When i run bash file.py or . file.py or source file.py get error like this: file.py: line 4: syntax error near unexpected ..... But ./file.py ...
3
votes
1answer
23 views

Unix tool to print directory (recursively, with ASCII art)?

Is there a command-line utility that can be run in a directory and output something like this, a pretty-printed directory structure? myproject └─ src ├─ master.scss ├─ my-module.scss └─ ...
-1
votes
1answer
33 views

linux command to get quarter details

I need to paas current date to linux command which will give me output for quarter number I have two queries date +"%Yq$(expr $(expr $(date -d '-1 month' +%m) - 1) / 3 + 1)" result -> ...
0
votes
1answer
32 views

I have an SSH session. Now I want to run a script on the remote host that opens in a new window on the local host. Is this possible?

I'm on Machine A and am SSHing into a headless remote host Machine B. (Ubuntu 14.10 Server.) I have several scripts that I wish to run. However, they will occupy my session window. These scripts are ...
0
votes
1answer
14 views

bash: or (`-o`) operatorator in `[[` (double square bracket)

(This question probably has been asked before but is very difficult to search due to the symbols...) The bash manual did not make it clear whether [[ (double square bracket keyword <- SEO) ...
1
vote
1answer
12 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 ...
0
votes
2answers
36 views

Why doesn't my IF ELSE work?

It's a simple script I wrote, nothing fancy at all @echo off echo 1 = stream1 source echo 2 = stream1 high echo 3 = stream1 medium echo 4 = stream1 low echo 5 = stream2 source echo 6 = stream2 high ...
0
votes
1answer
39 views

How to get stdout of a “lost” session

I don't well what's the name of the situation, I think yesterday I closed a session with a background ipython process, but I am still able to connect to it (the process is running a web server and I ...
0
votes
1answer
21 views

Delete first line from a file and Update

Here is the file i work on "list": g-8.xx.yyy.zzzz g-9.xx.yyy.zzzz g-10.xx.yyy.zzzz g-11.xx.yyy.zzzz g-12.xx.yyy.zzzz Here is the script i try to complete ( i'd like to get the first line and ...
2
votes
3answers
65 views

What's the fatest way to calculate in command line?

Is there a faster way to calculate in command line the following: echo "4 * 5" | bc
0
votes
0answers
22 views

Are there any commands I can issue on DD-WRT to force full duplex (no vlan tab present)

Need to force full-duplex on my dd-wrt router, the vlan tab is missing and the direct link to it doesn't work either.
2
votes
1answer
44 views

Delete empty directories Synology NAS Shell

I try to delete my empty directories on my Synology NAS (DS415+). I tried: find . -type d | xargs rmdir But the problem is that I have directroies with spaces in the names like "hello (2012)". ...
1
vote
2answers
37 views

how to gzip and scp at the same time

I have a file in which i wanted to zip up and at the same time transfer over to another host using scp. I tried to do the following command but failed. I do not mind zipping up and scp over later, ...
0
votes
2answers
15 views

Rename multiple folders using shell script without matching a pattern

How to rename multiple folder/files by user defined. Say for Ex. I have multiple folders like krish, moorthy, ravi, robert, etc.. I want to rename all these directories as script_1 , script_2, ...
0
votes
0answers
45 views

Modify right click context menu with copy filename or copy full file path

I'm wanting to modify the right click context menu for windows explorer. I need to select a number of files and right click on them and copy the file path. Ideally I would also like the option of ...
0
votes
1answer
41 views

How to use echo in shell command from Makefile?

I have a GNU makefile. It runs fine on Linux, Solaris and OS X. However, under Cygwin-32, Cygwin-64 and MinGW, it produces: /bin/sh: -c: line 0: syntax error near unexpected token `(' /bin/sh: -c: ...
0
votes
1answer
24 views

scp files between hosts using ssh local port forwarding

I have a problem about transferring files between hosts. Lab environment is like: My host <-> Host A <-> Host B I only have access to Host A and I want to transfer files to Host B. Host A has ...