Questions tagged [sh]

sh stands for a shell. It is also often used as extension for a shell script.

49 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
1 answer
220 views

Ssh X11 forwarding messes up with default shell

I have a bash specific code in my bash profile: $ cat ~/.bash_profile #!/usr/bin/env bash echo "SHELL: $SHELL" function printfiles() { while IFS='' read -r _file || [[ -n "$_file" ]]; do echo ...
kaligne's user avatar
  • 269
3 votes
1 answer
3k views

execvp exec format error for shell script on Red Hat Enterprise Linux 6

We have two RHEL 6 systems that are running identical versions of the kernel and glibc (glibc–2.12–1.90.el6_3.6). According to the POSIX standard and the Linux man pages, if the kernel determines that ...
telotortium's user avatar
2 votes
0 answers
976 views

Dash rc files for non-login non-interactive shells

Does dash have a non-interactive non-login rc file? I've read the man page, which recommends .profile for login shells and $ENV environment variable for interactive shells. Is there anything that ...
Nick Bull's user avatar
  • 133
2 votes
0 answers
1k views

How to suppress "stty: standard input: Inappropriate ioctl for device" in Jenkins console

I use PHPUnit with Jenkins. PHPUnit outputs many "stty: standard input: Inappropriate ioctl for device." like this [***] $ /bin/sh -xe /tmp/jenkins3872195701082406677.sh  + vendor/bin/phpunit tests/ ...
Kimitaka Watanabe's user avatar
2 votes
0 answers
288 views

AIX sudo rootsh

I'm allowed to do: sudo /usr/bin/rootsh -i -u user Additionally I want do something like: echo 'date' | sudo /usr/bin/rootsh -i -u user Here I get the answer: no tty/pty on stdin: Not a ...
Gerold's user avatar
  • 21
2 votes
1 answer
2k views

using screen with start-stop-daemon, sysv

I'm trying to run a program with an ncurse interface as a daemon using screen. I want to use start-stop-daemon to manage the process, but I'm having trouble creating a SysV init script. Variables: ...
John David Ravenscroft's user avatar
1 vote
0 answers
38 views

Grub script how to remove menuentries

I made a grub script to detect bootable disks and show them on grub menu. It is working but I want to put a rescan button and to make that first I need to remove old menuentries. How can I do? My ...
0x01010's user avatar
  • 111
1 vote
1 answer
2k views

Rsync creates empty folders

I have following directories. My goal is to compare OLD vs NEW directory and save the different files in the DEST directory: OLD/ ...src/ ...src/config.js ...test/ ...test/main.js NEW/ ...src/ ......
user avatar
1 vote
0 answers
41 views

FFMPEG Bash Script incorrectly using cover metadata instead of images

I'm trying to run a script that that is meant to convert a folder of images and a folder of audio into videos however it's pulling the metadata of the album art instead. Looking for a correction ...
Orophix's user avatar
  • 37
1 vote
0 answers
41 views

debian + plink on windows

i am working on a script on windows that should execute a debian .sh script when i get a [COMPLETE] line on my irc channel. But can't figure out where to put the line in my irc script. so maybe if ...
sbh7600's user avatar
  • 45
1 vote
0 answers
142 views

Open VPN Install Script error (CentOS 7)

this is the error I am getting when I attempt to create a new user cp: cannot create regular file ‘/home/root/aaron.ovpn’: No such file or directory ./centos7-vpn.sh: line 984: /home/root/aaron.ovpn: ...
Deqness Hosting's user avatar
1 vote
2 answers
2k views

Get intermediate nodes using ping

I need to get intermediate nodes when requesting the route through ping. I can get the intermediate routes through traceroute url, but in the server there's a problem I cannot use traceroute. I ...
Devortz's user avatar
  • 11
1 vote
1 answer
421 views

find file containing a function

I would like to know a way to get the file that contains a function that is accessible because it's been sourced in shell. For Bash and ZSH. For example when I want to find out the source of function ...
d-nnis's user avatar
  • 11
1 vote
0 answers
96 views

Bash script - Finding files and manipulating paths

So I'm attempting to write a script that achieves the following: Reads file UID from a text file Searches for file location based on the UID Copies the file, including it's path structure to a new ...
Grinch91's user avatar
  • 111
1 vote
0 answers
95 views

Problems in customizing the macOS menu bar with MenuSystemUIServer

In my menu bar, I'd like to hide TimeMachine, Volume, Battery, User, Clock and show just Bluetooth, and Airport. I tried to customize it with an sh script: for domain in ~/Library/Preferences/ByHost/...
Luke's user avatar
  • 275
1 vote
0 answers
2k views

execl: couldn't exec `/bin/sh'

I accidentally moved the whole bin, boot, dev and etc directory. After moving everything back I get the following error email from various cron jobs: execl: couldn't exec `/bin/sh' execl: No such ...
Jeroen's user avatar
  • 111
1 vote
1 answer
4k views

How to force a longer `reboot` in Busybox v1.13.3?

reboot appears to make the root file system read-only almost immediately, causing a race condition with one of my processes which tries to write settings out to a file during its approx 1-2 second ...
Lightness Races in Orbit's user avatar
1 vote
3 answers
270 views

Read everything that has been echo'd and 'errored' to terminal window?

I've inherited a complex shell script running on OSX that gets run on a crontab. Within the script I would like to periodically read everything in the terminal window and write it to another file... ...
Topher's user avatar
  • 11
0 votes
0 answers
144 views

I have not captured a screenshot using the service

I am using a shell script and I want to run the script automatically when the system is ON/Restart without opening any application. Here is my script.sh file: while sleep 5 do scrot 'myimage.png' -e '...
chirag tomar's user avatar
0 votes
1 answer
900 views

Execute Script Via SSH And Disconnect Immediately

The idea is to connect to a remote machine via ssh and execute a shell script without waiting for it to finish. EDIT: The issue was ssh, not nohup.
James's user avatar
  • 1
0 votes
0 answers
170 views

MSYS2 - Change to /bin/sh

How would I switch my default shell from bash to sh in MSYS2? Even just trying to do something as simple as pacman -S sh tries to install bash.
Techflash's user avatar
0 votes
1 answer
212 views

How to copy hidden file names to a text file in unix?

I have several directories which contain hidden empty files. I need the name of these file names themselves, so I need to write the filenames to a txt file. My script looks like this: cd /z/...
Fnechz's user avatar
  • 1
0 votes
1 answer
451 views

Why is sudo able to run in fakeroot?

Take the following snippet: fakeroot -- sudo cat /etc/shadow This will print out the contents of /etc/shadow, but doesn't running sudo in fakeroot ruin it's whole purpose, or am I missing something?
Plasma's user avatar
  • 101
0 votes
1 answer
567 views

List of JSON strings as command arguments

I've been working with GitLab CI recently to automate some busy tasks, namely auto releasing binaries for version tags. For those who don't know Gitlab CI, it is very straightforward. It pulls the ...
Awbmilne's user avatar
0 votes
2 answers
243 views

Some standard commands freeze on remote machine

I'm using a remote machine (ssh connection), and some commands suddenly stopped working. By that I mean that I enter them and nothing happens: they just kind of freeze, without any output and without ...
Dmitry's user avatar
  • 113
0 votes
1 answer
505 views

Bash script which logs log in/log out event of users in real-time

I'm curious about bash script, which will write information to the file once any user will log in/log out to the system in real-time? Can I check it by filtering of commands from ps ps -eo user,...
user avatar
0 votes
1 answer
3k views

Why is my .sh file not running in LXDE/autostart on Debian but works on Raspbian?

I'm switching from a raspberry pi (raspbian) to a tinkerboard (debian) and am unable to get the scripts running in my autostart file that I use in raspbian working on debian. On Raspbian: sudo nano /...
Lauren's user avatar
  • 1
0 votes
2 answers
2k views

"Access Denied" as root

I have connected to my wireless router via telnet as root. It runs on linux kernel and has busybox. / # cat /proc/version Linux version 3.4.110 (root@A23176683) (gcc version 4.7.2 (Buildroot 2013.02) ...
Danil's user avatar
  • 11
0 votes
0 answers
123 views

How can I exchange a hash password for a newer one at AIX and Linux using shell script?

We have AIX and Linux machines that we can use puppet to change password automatically. But in some cases we need to do this manually. But I decide to write a script and change the old hash with a ...
Marlon's user avatar
  • 369
0 votes
0 answers
385 views

How to run a command when any process starts?

I have an sh script to update my wallpaper which uses pscircle in order to display running processes. The script runs every five seconds to update the wallpaper, but I would like it so that the script ...
The Forgotten King's user avatar
0 votes
1 answer
284 views

Bash modifying text between marked lines

I have a file with more than 8000 rows. File is divided into sections, each section is labeled with text like ##C, ##T,##N. I have to modify some rows in the file. I used command SED to mark lines ...
pesekvi's user avatar
0 votes
3 answers
4k views

Quit loop if a key is pressed

I want to exit the script if any key is pressed. #!/bin/sh while true; do df -h | head sleep 10 clear done Any suggestion?
BOUABANE Raed's user avatar
0 votes
0 answers
91 views

screen command called from within a script, within a "su -c" command creates files on root directory

I'm executing this script from user root in directory "/": su -c "sh /home/bob/start_server.sh" bob and "start_server.sh" contains screen -d -m -S serverscreen mono startserver.exe However all the ...
NaturalBornCamper's user avatar
0 votes
1 answer
30 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 ...
Automator's user avatar
0 votes
0 answers
1k 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, ...
Zac's user avatar
  • 163
0 votes
0 answers
510 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 ...
ThePiachu's user avatar
  • 191
0 votes
0 answers
631 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 ...
Brad's user avatar
  • 1,685
0 votes
1 answer
88 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/...
user avatar
0 votes
1 answer
113 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 ...
xOneca's user avatar
  • 71
0 votes
0 answers
37 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.
Protostome's user avatar
0 votes
1 answer
93 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 ...
Pervert-san's user avatar
0 votes
1 answer
624 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}...
user356446's user avatar
0 votes
2 answers
4k views

Copy shell configuration from one machine to another?

I've got login to another server where shell configurations are not like I would want. For example I don't see my username and CWD on prompt, and when I press arrow key, instead of giving last entered ...
Andrius's user avatar
  • 607
0 votes
2 answers
384 views

How to make an alias and work in sh for all users (not in bash)?

My question maybe is silly, but how can I make an alias so as to work in sh for all users? I know that I can put an alias, let say this one: alias ls='ls -l' in /etc/bash.bashrc so as to work in ...
Thanasis Petsas's user avatar
0 votes
0 answers
350 views

bash script rm cannot delete folder created by php mkdir

I cannot delete folder created by php mkdir for I in `echo $*` do find $I -type f -name "sess_*" -exec rm -f {} \; find $I -type f -name "*.bak" -exec rm -f {} \; find $I -type f -name "...
ali's user avatar
  • 1
0 votes
1 answer
690 views

Symbolic links for directories

Really need a quick help on this. This is the scenario. Created source directory SOURCE : /apps/application_scripts/intl/bin Here I have lot of shell scripts (*.sh) TARGET : /home/edwprod/intl/...
user avatar
0 votes
1 answer
1k views

How to configure using arrow key to repeat previous shell commands in Minix

I am new to Minix. I'm so impressed by the speed of the system. It looks elegant, I like it. However, I have a question about the shell. In Linux, while using a shell, up and down arrow keys can be ...
user avatar
0 votes
2 answers
1k 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):" &&...
herros's user avatar
  • 1
-2 votes
1 answer
183 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/...
Soufiane Mohamed Bouhaik's user avatar