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

learn more… | top users | synonyms

1
vote
1answer
6 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
30 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
0answers
15 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
17 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
53 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
9 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
19 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
29 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
12 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
28 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
19 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
15 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 ...
2
votes
1answer
42 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 ...
0
votes
1answer
30 views

bash error when starting shell from tmux

When I open a new shell in tmux I get an error message. This error message does not show up when I start a new shell in GNOME terminal. What might tmux be running at startup that I need to check? ...
0
votes
2answers
20 views

Command host with awk

Please, why "echo" instruction: iphost="$(ssh root@$machine -x "host $machine | awk '/has address/ { print $4 }'")" echo $iphost display: g-3.xx.yyy.zz has address 172.16.65.35 instead of: ...
0
votes
2answers
45 views

How can i get the hostname of the machine i work on?

Please, how can i get the hostname (fully qualified domain name) of the machine i work on ? Here is my script: #! /bin/sh hostname=$(host $ipaddr | awk '{print substr($NF,1,length($NF)-1)}') ...
10
votes
3answers
1k views

How to run a command in background with no output unless there's an error

How to suppress a command's output but show it if the command exit codes an error?
1
vote
0answers
9 views

RVM is not a function message when using fish shell

I'm trying to use rvm from within the fish shell rvm gemset use rails3 I'm getting the following error message from fish RVM is not a function, selecting rubies with 'rvm use ...' will not work. ...
0
votes
1answer
17 views

Script Shell Storing ip address in a table

Here is my file: test.txt 172.16.65.29 172.16.65.30 Please, how can i modify this script to store all ip address in test.txt in a table. for ip in ${iparr[@]} do echo $ip done Thank you so much ...
-3
votes
1answer
25 views

How to get started with shell scripting? [closed]

My job profile requires a certain level of shell scripting and I have no idea on how would i get started with it Please suggest me with the easy ways to getting started with shell scripting. Thank ...
0
votes
0answers
6 views

Axel usage with script on UBUNTU

I write a shell-script to download files via axel but always I get a 403 FORBIDDDEN error. At the same time I copied the axel command which generated by my script to terminal manually and it works ...
0
votes
2answers
44 views

How to tell what are my startup files for sh or bash?

From this question I understand that depending on the operating system sh and bash behave differently. Doing env and alias I can tell that: Every time I open a OSX Terminal or run bash the variable ...
1
vote
0answers
35 views

Shell Commands not working : REDHAT

I added some service to the startup script and then after reboot , i got this message- 24 package(s) needed for security, out of 52 available Run "sudo yum update" to apply all updates. -bash: id: ...
2
votes
1answer
45 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.
1
vote
1answer
25 views

xrandr | grep “ connected ” give me more than one line but IFS=$'\n' read can't break it

I have something like this: declare -a DISPLAYS AUXILIAR="$(xrandr | grep " connected ")" IFS=$'\n' read -ra DISPLAYS <<< "$AUXILIAR" Why it isn't detecting line breaks if echo ...
1
vote
1answer
17 views

bash: history -a not writing unless HISTFILE already has text

Problem statement I've been following numerous examples for doing creative things with bash history along the lines of: # simplified example PROMPT_COMMAND='history -a; history -c; history -r' ... ...
0
votes
0answers
7 views

Let ctrl-c end entire fish function instead of one command in the function?

When executing a multi-line fish function, is there a way to let ctrl-c terminate the entire fish function instead of terminating just the currently running command in the function and letting the ...
3
votes
1answer
44 views

How to sort the output of find? [duplicate]

I'm using the find command to list files with their name containing a string: find ~/ -type f -name "*inductive*" I would like to use a pipe to sort the resulting list of files. I would like to be ...
1
vote
3answers
32 views

Extract a word from a string in shell script

I have a string as $sea = xyz-ajay-no-siddhart-ubidone-fdh-DMJK.UK.1.0-32133-Z-1.tgz and i want to extract only DMJK.UK.1.0-32133-Z-1 and search string will be DMJK I tried like echo $sea ...
0
votes
1answer
21 views

Double SSH and execute interactive shell

I need a bash script to ssh into server a then server b then execute an interactive shell. This is what I have: ssh -t -t server-a.com exec "ssh -t -t server-b.com <<<EOF cd ...
0
votes
1answer
30 views

How to upload all the files from local to host using Curl?

i have written a shell script to upload all files with different names in the specific path from local to host, but i have facing some issue and the files are not getting uploaded #!/bin/sh for file ...
0
votes
0answers
28 views

Running 'su - user sh -c “~/.profile”' returns “No such file” error

I have a shell script running as root with the following command: ssh remotehost 'su - user sh -c "source /home/user/.profile; <command>"' I get the following output: bash: su - user sh -c ...
2
votes
2answers
52 views

How to change the default shell in Cygwin?

I am trying to change my default shell from bash to zsh in cygwin. The normal unix command chsh isn't available on cygwin The etc/passwd file it seems isn't used anymore in existing versions of ...
0
votes
0answers
6 views

How to stop control/focus leaving the terminal when I start a GUI application

I have a Ruby script that launches Image viewer (eog) based on certain keyevents from the user. However Focus leaves the terminal(cursor stops blinking) when the first input is given. Until I click ...
0
votes
0answers
11 views

Why is OfflineIMAP working in reverse on my inbox?

Noticing some weird log messages coming out of offlineimap when I make my periodic sync, after I spent all night syncing all my messages down from Gmail. Here's an example of one of them: Folder ...
0
votes
1answer
34 views

Fixed space/width printing of variables in shell

I have made a tabular report of some data variables printed via printf in shell. Project One | 76 | 80M | 80M | 80M Project Two | 46M | 52M | 52M | 52M Project Three | 174 | ...
0
votes
1answer
11 views

Call MATLAB installed on network drive from Cygwin shell script

MATLAB is installed on a network drive, and I want to call it from a shell script. The installed location is \\apps\matlab2014b$\bin\win64\MATLAB.exe in P:\. I am using Cygwin to run the shell ...
-1
votes
0answers
51 views

How to populate environment variables in Mac OS X for CLI _AND_ GUI applications

I mostly use Linux as my development box, but I also run a Mac OS X based setup, which I would like to behave mostly as my Linux one. The main problem I face is to sync my environment variables I ...
0
votes
1answer
42 views

Multiple Conditions in shell script

Im stuck in giving two conditions in my script. I can read two things - What is the NEAREST SERVER If it is MacBook or Anything Else and then use defaults write command to modify the plist file. ...
2
votes
2answers
33 views

bash script.sh vs ./script.sh vs #shebang

Assuming i am in a bash shell now and i execute the following [me@server]$ bash script.sh q1) Is a new child bash process created to execute the script ? If i do a [me@server]$ ./script.sh q2) ...
2
votes
2answers
30 views

Running bash scripts from bash script in other folder

I've got several folders (one for each month), each with a bash script savetodatabase.sh. I want to run all of them after each other, so I made a script named saveall.sh which has the following code: ...
0
votes
1answer
21 views

String replacement shell script on AIX

I am using AIX, and there is not an -i option available in the version of sed I am using: sed: illegal option -- i Usage: sed [-n] Script [File ...] sed [-n] [-e Script] ... [-f Script_file] ...
0
votes
3answers
73 views

What is the config file for the sh shell on OS X? (i.e., ~/.bash_profile for bash shell, etc)

R uses the /bin/sh shell environment and I'm running scripts (that cannot be modified) that call gfortran-4.8 instead of gfortran so I'm creating an alias. I have added the following line to my ...
0
votes
1answer
38 views

How to open git for windows shell inside a tab on ConsoleZ

I have used git bash 1.9.5 from https://git-scm.com/download/win on ConsoleZ as shell and have no problem on open him inside a tab. But, with the new Git for windows 2.4.5.1 RC4, it open always in a ...
0
votes
0answers
25 views

Change bash to default login shell on AC66U running Merlin and Entware

I'm trying to switch from sh to bash as my default login shell, on an AC66U running the Merlin firmware. I have bash installed in entware's partition, but when I switch user:x:0:0:user:/root:/bin/sh ...
0
votes
1answer
61 views

Emulate a Linux terminal and shell commands in Windows [closed]

Ok, I am accustomed to Linux/Unix like terminal and its commands and now I am using Windows. Does anyone know how to emulate a Linux terminal and the bash Commands?
1
vote
1answer
35 views

Redirections shell

Can anyone explain the following? :~$ ls macreave.sh fgvdvg > testo 2> testo :~$ cat testo macreave.sh ccess fgvdvg: No such file or directory :~$ ls macreave.sh fgvdvg > testo ...
0
votes
0answers
13 views

Customize predefined entries in Windows Start Menu

I would like to add some custom entries to Windows XP / Vista / 7 Start Menu and place it between predefined options like: "Help and Support" and "Run" so that user cannot delete or move those ...
0
votes
1answer
28 views

/bin/bash -c stopping counting with date

/bin/bash -c not starting counting with date: /bin/bash -c "while true; do echo [`date +'%F%t%T%t%Z'`] Keep Alive; sleep 1; done" The output is: [2015-07-06 13:44:36 UTC] Keep Alive [2015-07-06 ...
0
votes
5answers
43 views

Extract filename from file using shell script

I have a text file which has the following line: /u/tux/abc/spool/frtbla_mcdetc_0000149099_20101126135009990_1.tif I want to extract frtbla_mcdetc_0000149099_20101126135009990_1.tif; the word after ...