Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [sh]

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

Filter by
Sorted by
Tagged with
-2 votes
0 answers
21 views

how to run a game in gardle for windows? or sh, I don't know which one to use, I would like help running the script

I don't know what to do to do this, and I really wanted to play this gameenter image description here https://github.com/nh-99/NuclearPizzaWar-Mojam (this is the game i dowload) i try Run ...
War's user avatar
  • 1
0 votes
1 answer
69 views

sudo user input sanitize, to avoid error "bash: Invalid option" or "sh: Invalid option"

I'm using sudo from bash to execute an arbitrary wild command as a specific user. This works perfectly in general cases: sudo --login --user=maria -- "$COMMAND" For example, this calls the ...
Valerio Bozz's user avatar
0 votes
1 answer
30 views

Why directories are not being expanded and some others are not created?

I am using Docker and I am trying to run the following script in the container which uses Alpine Linux and sh as a shell: Note: SCANDISK_MOUNT and SCAN_MOUNT are environment variables defined as var/...
ReynierPM's user avatar
  • 375
1 vote
0 answers
41 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
0 votes
1 answer
99 views

sh source permission denied trying to call another script

Can you make a sh script call another script? (Apparently not.) rwb@calleva:~/source$ ls -l total 8 -rwxr--r-- 1 rwb rwb 50 Oct 22 03:38 caller.sh -rwxr--r-- 1 rwb rwb 30 Oct 22 03:36 sourced.sh rwb@...
Richard Barraclough's user avatar
1 vote
3 answers
384 views

Using read -r within in-line shell scripting

I have a file that contains a list of absolute paths of several files. I need to move all of the files listed in the file to another directory. Unfortunately, I have to do this using in-line shell ...
jharrison12's user avatar
1 vote
1 answer
70 views

How to create abnormal amount of subdirs?

I want to create 1000x1000x1000x1000x1000, etc. directories, but something like mkdir -p {1..1000}/{1..1000}/{1..1000}/{1..1000} gives to many arguments error or just infinitely eats my RAM... How can ...
RegreTTO's user avatar
0 votes
1 answer
217 views

Bash script vs command line

I have started working on bash scripts. I have just observed a difference between executing a command line and executing the same commands but inside a script. In particular the command line is: for a ...
Siderius's user avatar
  • 184
0 votes
0 answers
145 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
1 vote
2 answers
3k views

How do I use xargs to pass arguments as $1, $2, $3, ... to an inline script called with sh -c?

I want to pass tokens a b c as arguments of a script that will output a - b - c. If I have a script dummy.sh that does echo "$1 - $2 - $3" and a dummy.dat file containing : a b c d e f and ...
Sybuser's user avatar
  • 147
0 votes
1 answer
965 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
1 answer
7k views

How to use git pull with Jenkins sh steps?

git pull doesn't work with Jenkins for some reason. I've updated some files on my local PC and pushed it to my Github. I can see the changes there. Then I run Jenkins build that has sh commands to ...
J. Doe's user avatar
  • 17
0 votes
0 answers
175 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
4 votes
1 answer
779 views

/bin/sh is symlinked to bash, but completely different?

If I do ls -l /bin/sh: I get lrwxrwxrwx 1 root root 4 Jan 9 00:01 /bin/sh -> bash However, when I start sh, I get a completely different prompt than I would, my ~/.bashrc isn't sourced, and if I ...
A-random-nerd's user avatar
0 votes
1 answer
93 views

Sending FreeBSD script output by email loses format (left aligned and right aligned in one line)

every day I am running a script on my router to check the traffic usage of a specific server. The script is working fine and with this output part of the script, I get following result: #Give output ...
Asiaexplorer12's user avatar
0 votes
1 answer
221 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
274 views

Windows : launch .sh using environment variable

i'm trying on windows to launch my server from anywhere in my computer (start_server.sh). Launching my file containing those line manually works fine (using GitCMD) (probably not the best, i'm of ...
mt.i.1's user avatar
  • 3
1 vote
2 answers
66 views

Creating multiple symlinks from a string

I have the following script: #!/bin/bash test="../t1,../t2,../t3" ln -sf "{${test}}" . Above this directory consists of 3 directories: ../ ├── script │   └── test.sh ├── t1 ├── ...
dogman's user avatar
  • 13
0 votes
1 answer
480 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
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
0 votes
1 answer
580 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
3 votes
1 answer
49k views

"/bin/sh: 1: MY_COMMAND: not found"

Error During docker build -t MY_IMAGE_NAME ., using a Dockerfile for a ROS project, at line RUN source /opt/ros/melodic/setup.bash the following error appeared: => ERROR [stage-2 19/19] RUN ...
questionto42's user avatar
  • 2,361
5 votes
1 answer
2k views

sh source can't find files

I have an Ubuntu 20.04 installation. I seem unable to source files with sh, which is Ubuntu's default dash. I have a file, lets say build.env, with some environment variables in it like this: build....
hat's user avatar
  • 153
0 votes
1 answer
642 views

Start up shell stuck in /bin/sh how to change it back to zsh default at startup

Whenever I start my cli, it keeps starting up in /bin/sh. I've searched various different forms and none so far have worked for my issue. I also tried various options like chsh (1) <--- this only ...
Michel's user avatar
  • 1
0 votes
1 answer
66 views

How to run drkspider.sh on windows 10

I have downloaded DRKSpiderJava v0.83 but I cannot run the file "drkspider.sh" on Windows 10. I tried with cmd, CYG, bash but don't know why cannot open it. Maybe I am doing something wrong?
user avatar
0 votes
1 answer
141 views

Corrupted Files Delete in Windows [duplicate]

I am preparing a file using shell script and while doing some tests, I added the pause> nul line into my sh file. Then I ran the sh file, but there was a file named nul on the desktop and I can't ...
user avatar
3 votes
1 answer
808 views

Is there a `read -n` equivalent command for Bourne shell?

Is there a way to make my script wait for the user to press any key and then continue without them having to press Enter? I want to make it work in Bourne shell (sh), not Bash.
randomPerson's user avatar
0 votes
1 answer
147 views

bash vs zsh man page search feature differs

I'm switching to zsh from bash, but I just realized that when I'm in a man page in bash and use / to search, I can use the hyphen - like this: /-V and all -V occurences will be found, as expected. But ...
ram's user avatar
  • 161
0 votes
2 answers
251 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
2k views

how to run multiple shell scripts one by one in single go using another shell script

Dear experts i have a small problem...i am trying to run multiple shell scripts having same extension(.sh) in one go, which are present inside a directory. In so far i wrote a common script like as ...
Tom Hayes's 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
3 votes
1 answer
1k views

Looks like cron spawns a shell which in turn spawns a script; how can I get rid of the intermediate shell?

The OS is CentOS 7. I have a rather basic understanding of crontab and crond. I created a crontab entry using crontab -e: */5 * * * * /root/script.sh > /dev/null 2>&1 The script detects if ...
Thejaka Maldeniya's user avatar
0 votes
1 answer
509 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
80 views

Modify a file via a script with special rights

Probably this is elementary.. Yet I didn't find an explanation to what's happening.. I have these files with these specific rights: So modtp2 is a shell script I'm using to change tp2 content with a ...
7o7o's user avatar
  • 1
2 votes
1 answer
4k views

Why isn't systemd running my ExecStartPre script?

I have two graphics cards, and need to configure xorg to use the right card based on the boot option I select in grub. To achieve this, I've added an arbitrary string to the kernel params of one boot ...
Dan Scally's 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
1 answer
159 views

Why does the value of $HOME vary between Ubuntu 18.04 & 20.04 in a script using sudo

On Windows 10 v1909, I am using WSL (Ubuntu 18.04 & 20.04: 4.4.0-18362-Microsoft x86_64 GNU/Linux) and I noticed the value of $HOME within an arbitrary script varies between Ubuntu 18.04 and 20.04 ...
Umair Khan's user avatar
6 votes
1 answer
5k views

How or where to define global functions to be used in bash, zsh, sh scripts?

Say I have these three script files: (all 3 are executable) bash-test.sh: #!/bin/bash HelloFromBash RocketNuts zsh-test.sh: #!/bin/zsh HelloFromZsh RocketNuts sh-test.sh: #!/bin/sh HelloFromSh ...
RocketNuts's user avatar
  • 1,142
6 votes
1 answer
14k views

What does 'x' mean in this line #!/bin/sh -x?

Could you explain what 'x' means in the shebang #!/bin/sh -x ? Does it necessary to put '-x' in this line?
t7e's user avatar
  • 711
12 votes
1 answer
3k views

What is the second sh in `sh -c 'some shell code' sh`?

Question I encountered the following snippet: sh -c 'some shell code' sh … (where … denotes zero or more additional arguments). I know the first sh is the command. I know sh -c is supposed to ...
Kamil Maciorowski's user avatar
2 votes
1 answer
157 views

How does this find state actually work in moving a file up one directory?

Can someone explain how the string manipulation in this find statement actually works? My head is about to explode trying to figure it out. :-o From: UNIX shell scripting: how to recursively move ...
Richard Westby-Nunn's user avatar
2 votes
0 answers
983 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
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
2 answers
969 views

showing degree symbol bash/tcl

im trying to get a login script to display degree symbol but it doesn't display it. Here is the weather.sh METRIC="1" # 0 for F, 1 for C # Fill in form to find your weather code here: # http://...
sbh7600's user avatar
  • 45
0 votes
1 answer
308 views

systemd start at boot but it is stopped

I have developed a shell script : #!/bin/sh # do some treatment for i in `seq 0 10000`;do # do some treatment and create/write into log file done NOTE: my script work manually perfectly without any ...
Embedded Software Engineer's user avatar
0 votes
0 answers
126 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
2 answers
2k views

macOS Catalina /bin/sh vs /bin/bash and showing history with preceding hash

Not really a question but an observation. When I do sys ad on Linux, I like to precede commands with a hash '#' to proof-read what I am about execute, and also to leave a breadcrumb so that I can come ...
meappy's user avatar
  • 1
0 votes
1 answer
52 views

OK in bash, not OK in sh - convert diff < (ls) <(df)

In GNU Bash, diff <(df) <(ls) is running. In sh, it isn't. I also tried [[diff </bin/df <bin/ls]], still error: $ [[/usr/bin/diff < (/bin/ls) < (bin/df)]] sh: 1: Syntax error: "(" ...
johnmavvv's user avatar
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
2 3 4 5