sh stands for a shell. It is alo often used as extenstion for a shell script.

learn more… | top users | synonyms

8
votes
1answer
537 views

Why doesn't this softlink work as expected?

bash4.3 # pwd /bin bash4.3 # ll sh lrwxrwxrwx. 1 root root 4 May 17 22:22 sh -> bash bash4.3 # ll bash -rwxr-xr-x. 1 root root 1072056 May 17 22:22 bash bash4.3 # bash bash4.3 # ...
0
votes
1answer
11 views

Run Script on OSX Automatically

How can I run a script I made on my mac automatically. It needs to run once a day. Because it requires rsync the mac needs to be connected to the internet and I have realised when it is sleeping wifi ...
0
votes
1answer
16 views

Reset Cache using bash

I'm trying to automate a .sh file to run every time before Chrome opens, here's what I want to do. rm -rf /home/pi/.config/chromium tar -cvf reseterfiles.tgz /home/pi/.config/ The zipped ...
0
votes
1answer
50 views

How to transparently substitute sha1sum for shasum in sh shell?

I have a test that needs to run on multiple platforms. On all other platforms, the test uses sha1sum, but on my Mac OSX El Capitan, there is no such program installed, but shasum works fine as a ...
0
votes
0answers
25 views

Startup script unexpected results

I'm experimenting with a small script to setup my webserver on Vultr. This is a "Startup script" that is used by Vultr on the background after deploying a new machine for me. If I run manually with ...
0
votes
0answers
71 views

sh command not found on Windows 10

I'm trying to install devkit using the command npm install -g devkit. It makes a loading bar which goes on for a few minutes then gives an error, firstly saying that the sh command can't be found, ...
0
votes
0answers
14 views

How to make ConEmu execute .sh in the same window with Git for Windows?

I'm using ConEmu on Windows with Git for Windows installed. When I try to execute an .sh script, the software starts an instance of Windows' default console and executes the script there. How can I ...
3
votes
0answers
45 views

Redirecting display linux

from a sh shell, I am running a script calling a Software that requires opening a Gui. It ends up with a flashing window each time the call is run. I tried to unset the DISPLAY environment variable ...
-1
votes
2answers
43 views

what does “exec 5>>foobar.txt” do?

What does the shell command exec 5>>foobar.txt do? I can't google it for obvious reasons, and otherwise not sure where to start looking.
0
votes
1answer
24 views

Piping stdout from a command to stdin of two commands in sh

tee [using >()] command is not working because it is not supported in sh (bourne shell). What I am trying to achieve is sending the output of "ifconfig -a" to two different commands. This is my ...
0
votes
0answers
10 views

XWorking with .sh Files in XTerm

.I am trying to install my VPN software on my Lubuntu 15.10 and I am using Xterm to follow through a few commands. First I run wget https://www.privateinternetaccess.com/installer/install_ubuntu.sh ...
0
votes
0answers
34 views

bash “vi mode” search command line (not history buffer)

When working in bash - if I am in "vi" mode, I can use ? or / to "search". However, this appears to search the history buffer. If I am working with a (very) long command line, I would like to be able ...
2
votes
1answer
99 views

How is WinSCP able to provide a sudo user for executing scp?

The tool WinSCP is able to perform a sudo on the remote machine to perform the scp as the sudo user. That leads me to think that this must be possible with the command-line version of scp as well. ...
0
votes
1answer
26 views

Duration time between cycles in a log file

My apologies if this is too basic, but I have a log with this kind of information: Mai 5 12:34:00 xoengine XO[1287]: [Xo|xoengineMain.cpp:122|0xb88ec60] starting xoengine 4.0.1.2 (x86) from [/usr/...
0
votes
1answer
63 views

Displaying unicode emoji in filenames on Ubuntu

I'd like to use emoji in filenames and access them on the command line, but I can't seem to get it to work with ls. Weird thing is, if I pipe into just about any other program, the emoji are correctly ...
0
votes
1answer
36 views

Debugging env vars from ssh

I'm writing a script and an application for an embedded board with linux - no X, only console. The only way to reach the target is via ssh, I don't have a monitor connected. The script should export ...
0
votes
0answers
22 views

pgpass does not execute

So i have a backup1.sh script in /home/user/ #!/bin/sh tar -czf /home/ruud/backup1.tgz /usr/lib/python2.7/dist-packages/openerp pg_dump -U dbadmin -h 127.0.0.1 123telcom -f /home/ruud/dbbackup.sql ...
0
votes
1answer
150 views

How to run script menu after new terminal window exits

I have a script that asks the user for input for options. When selecting the option I have it so it runs a new terminal and executes another script for the specified option. I still want the menu ...
1
vote
2answers
59 views

Whitespace treatment in OS X vs Linux in Bash

I am trying to run a very simple script on a few different platforms: #!/bin/bash STRING="this is a test" echo $STRING , and I cannot tell why on Mavericks and Yosemite I get the output: ./starter....
0
votes
1answer
6k views

Linux sh script throws “#!/bin/sh: not found”

i have a script #!/bin/sh # Automatically remove a torrent and delete its data after a specified period of # time (in seconds). TARGET=/var/www/transmission/completed USER=name PASS=pass BIN="/usr/...
0
votes
1answer
607 views

Can't install android studio on linux mint 17.2

I have downloaded android studio for linux , after unzipping the zip file I went to specif location which is android-studion/bin and open terminal there then i run ./studio.sh command , when I run ...
0
votes
1answer
60 views

Double exit in gzexe

I have seen in gzexe (source) they use the following pattern used in a lot of places all over the file: (exit $res); exit $res What purpose does the exit inside the sub-shell? Doesn't seem to do ...
0
votes
1answer
268 views

Why does sh not find files in my path that do exist?

When I type this in sh it outputs : $ $PATH sh: 12: /bin:/usr/bin: not found But, I do have a /usr/bin folder, and it's fuuuuull of stuff. Same thing with zsh: ▶ $PATH zsh: no such file or ...
0
votes
1answer
30 views

How can I append text in the middle of a pipeline?

With cat its possible to append a file to the data passing through a pipeline: foo | cat - somefile.txt | bar Is there a command that lets me append text without using an intermediate file? foo | ...
0
votes
2answers
177 views

sh -c in background

Original version: How to run sudo sh -c "command" in back ground In a terminal sudo sh -c "command" & starts in background but as soon as I press enter, the process exits [test@localhost app]$...
7
votes
8answers
830 views

Remove linux file named with set of shell responsive characters

I've created a file named \;:$"\' to test a software of mine. I ended up with an error, because I cannot delete the file property. I'm trying to find a precise character combination to remove it via ...
1
vote
2answers
309 views

Is there a way to have sh/bash/zsh “case” use a variable for a test value?

I'd like to have something like the following: #!/bin/sh # ... other stuff ... # some relatively static possibilities (srsp): srsp='this|or|that|the|other' # more other stuff case $something in $...
0
votes
1answer
121 views

How do I save a string of numbers from an ongoing command to a list in a shell script?

I am trying to make a shell script for recording macros via recording the individual keycodes of each button press. The command for it looks like this: xev | grep -A2 --line-buffered '^Key*' | sed -...
0
votes
1answer
95 views

How to extract a substring and add it to original string with sed?

I am trying to write an sh script witch receives a string as input, extracts a particular substring and adds it after an specified expression to the input string. I tried a lot with sed -i'N ... but ...
5
votes
1answer
160 views

How do I prepend a string to program output without waiting for the whole line?

I have a script that runs a command on a remote server using SSH. I want to prepend the string Remote: to every line of the output, but I don't want each line to be delayed until the whole line is ...
0
votes
0answers
22 views

Configure a default shell script environment

Is there any way to change the default environment when running sh -c <command>? It appears that .cshrc is not called when running command with a -c flag.
0
votes
1answer
54 views

cd to newest directory

Not strictly bash, but rather Bourne shell if possible. How can I programmatically cd to the newest directory? I want to install the latest package of whatever software, which is located in the newest ...
-2
votes
1answer
77 views

Bash executing command

Can anyone please give me the list generated by this : -{ for i in {1..100}; do lynx -dump -nonumbers -listonly [http]://www.dailymotion.com/user/MTDCafe/$i [http]://www.dailymotion.com/visited/user/...
0
votes
1answer
205 views

Bash scripts executed together don't kill background processes

I have a number of shell scripts that work very similarly to this question. Each script fires up a few background tasks, remembers their PIDs with $!, does some testing, and then kills the background ...
1
vote
1answer
39 views

Evaluating false in bash with multiple commands without a subshell

Bash evaluates the logical operators such that && always takes precedence. So for example: false || echo 1 && echo 2 1 2 and true || echo 1 && echo 2 2 Ok. So lets say I ...
2
votes
1answer
945 views

Is there a way to “source” a sh script from the fish shell?

I like to put many of my environment variable definitions in the .profile script. If I am using a POSIX-compatible interactive shell like bash, I can use the source command to re-export the ...
1
vote
3answers
108 views

Most efficient log “echo date”?

My coworkers write scripts with lines like this: echo "nightly $MACHINE restart begins at" `date` Which outputs something like this: nightly whitestar restart begins at Mon Oct 13 22:05:01 EDT ...
0
votes
1answer
5k views

Running sh.exe in windows cmd.exe: command not found

For some reason I need to run a (hopefully simple) sh file under Windows and be able to do so from another application. I can do that using cygwin, but for various reasons I need this operation to be ...
2
votes
1answer
111 views

Pipe standard error to file and keep it on standard error?

I have a script (fragment) for which I'm logging output and standard error: #!/bin/sh #... { date "+%Y-%m-%d %T" cd $workdir ls -ltr validfile badfile #example command that provides stdout, ...
1
vote
1answer
185 views

Bash - list files within date range

So far I've been basing my efforts around this blog and have come up with: startdate=”201407010000? enddate=”201408010000? touch -t $startdate ./startdatefiles touch -t $enddate ./enddatefiles find ./...
0
votes
1answer
2k views

unable to execute: Too many levels of symbolic links

By mistake, I executed these commands : sudo ln -sf bash /bin/sh sudo ln -sf bash /bin/bash When I rebooted the Linux server in recovery mode I got this message: init : Failed to spawn friendly-...
0
votes
1answer
29 views

why following script is failing?

#!/bin/sh declare -a LIST= ('a' 'b' 'c' ) is failing on Ubuntu on which /bin/sh is softlink to /bin/dash How can I declare list which will be supportable on all kind of shell ?
0
votes
1answer
28 views

Autostarting a script at boot doesn't recognize the function “function”

I'm trying to get a script containing a function to run just after root autologin on TinyCore 5.3. The script works fine if I launch it from the prompt after login like this ./script.sh But when I add ...
1
vote
3answers
2k views

How to find length of string in shell

i need to calculate it using pure sh shell only. What happening is /bin/sh is actually a soft link to bash or other shell.Hence ${#STRING} gives length of string as it is advance bash feature. Can ...
1
vote
2answers
61 views

two processes are listed for one shellscript?

I have a shell script which does somewhat simple. #!/bin/sh do something boring... When I execute the shell script like this, $ nohup sh mysh.sh > /null/dev/ 2>&1 & I see there are ...
0
votes
1answer
111 views

Memory usage of a process in a shell script

I want to find out the memory usage of a process in a shell script.I tried to use this piece of code : while[process] do if [ -e /proc/$pidno/statm ]; then m=`awk '{OFS="\t";print $1,$2,$3,$6}...
0
votes
1answer
112 views

sh + how to run command and set it into parameter ( VAL )

please take look on the following commands down, ( the shell is sh ) something not clearly for me when I run - eval echo \$arr$n , I get the value a as expected so why: VAL=eval echo \$arr$n , ...
0
votes
2answers
681 views

Getting errors trying to run shell script (Linux)

I'm trying to run the following script. I have run it before without issue, but now I encounter an error. #!/bin/bash # init function pause(){ read -p "$*" } echo & echo "(Website):" &&...
1
vote
1answer
1k views

Bash error while running script

I have a CentOS 6.5 64-bit dedicated server. The only thing I done on it is yum install java7, so I have not installed any other stuff. So in the directory /root I made this file (test.sh) #!/bin/...
4
votes
2answers
2k views

shell script to replace a keyword in a file with the contents of another file

I'm to create a .sh to replace a specific keyword in a file using the contents of an other file. template.html contains a unique string "PLACEHOLDER" it must be replaced with the contents of file "...