Questions tagged [shell]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
22 views

find command not filtering files by size correctly [duplicate]

I am trying to filter .out and .txt files from sizes 8 to 15 bytes (not inclusive). The directory from which the files are searched is given as the first argument when calling the shell. As input ...
0
votes
0answers
18 views

Setting many variables written in a file to set in the environment of Shell at a time?

I have written many variables to be set as environement variables in a file , how should i set them all at a time . Sample Code in File : BRUN_ABORT_DEPENDENT_JOBS_ON_NONZERO_EXIT="true"; export ...
0
votes
0answers
22 views

Ffmpeg batch convert mov to mp4 watch folder on mac [closed]

for i in *.mov; do name=`echo "$i" | cut -d'.' -f1` echo "$name" ffmpeg -i "$i" "${name}.mp4" done I want it to convert with these ffmpeg options ffmpeg -i movie.mov -vcodec copy -acodec copy ...
0
votes
0answers
35 views

Kill child processes of an OpenRC service managed by supervise-daemon

I have a shell script that spawns multiple processes, which run for an indefinite amount of time, however with the following OpenRC init script and the supervise-daemon daemon, upon stopping the ...
0
votes
1answer
24 views

Why tee writes to file content different from what it shows in console

I need to redirect all the output from cli app in alpine container to both - console and file, and then exit with that app exit code. As I have to use sh - I have found this solution on stack: ...
0
votes
1answer
30 views

Does zsh have an equivalent to bash's “history -c”?

I'm administrating a linux server of a club, but I'm not the only admin. All admins log in as root. Please don't ask me why, it was the majority decision of the other admins. I know that this is not ...
0
votes
1answer
44 views

How do you make .sh files open with Windows Terminal Ubuntu?

I really like coding in bash, but there used to be many limitations of bash functionality in Windows. Though now there are many benefits to the bash windows users now rather than how it was pre ...
1
vote
0answers
25 views

How do I tell that OSX is done with a file from the CLI?

When you copy a file in the new versions of OSX you get a bunch of placeholders: I'm trying to automate some stuff from shell scripts and want to know when OSX is done with these files, however I can'...
0
votes
0answers
35 views

how to fix the weird error “Operation not permitted”

[hadoop@worker-18 tmp]$ ./sysupdate -bash: ./sysupdate: Operation not permitted [hadoop@worker-18 tmp]$ chmod +x ./sysupdate [hadoop@worker-18 tmp]$ ./sysupdate -bash: ./sysupdate: Operation not ...
0
votes
0answers
10 views

Which shell do VS Code extensions use?

here,I got the problem that the same command run in the Windows CMD as run by the clang-tidy extension works for CMD but not in VS Code. Therefore I ask myself if (and if yes, which) another type of ...
5
votes
1answer
552 views

shopt: what is wrong with “&&”?

I dont get why when I do them separately it works but with && it doesnt (it's not a ( problem like here)... what am I missing? 11:20:06 $ shopt -s extglob && shopt -s globstar &&...
0
votes
1answer
27 views

Running bash script inside VS Code with Cmder terminal

I've just installed VS Code and added Cmder as a default terminal on a new Win10. I am trying to import my git for Windows .bashrc aliases to be used with Cmder. So I've added them to user_aliases....
0
votes
0answers
16 views

How to use poppler to convert pdf file to text

I downloaded and installed poppler-0.88.0 from poppler but don't know how to run the command to convert a pdf file to text. Poppler doesn't appear at unbuntu menu and I also try alt+f2 with popple but ...
0
votes
0answers
13 views

Why does a custom prompt on Linux (debian server) not work as expected [duplicate]

I am setting up a server (Debian) in Virtualbox, I am customizing the prompt, but I have a problem. When I write in the prompt customization, it is malformed. enter image description here This ...
0
votes
1answer
22 views

Logical AND operator in bash script

I want to check if the three files that were created are empty or not using AND operator. #!/bin/bash FILE_1="/root/Desktop/file1" FILE_2="/root/Desktop/file2" FILE_3="/root/Desktop/file3" if [[ -f "...
1
vote
1answer
31 views

how to enable command line navigation shortcuts in fish shell running in iTerm on Mac

Setup: MacOs Mojave, iTerm, Fish shell 3.0.2, using fisher have theme bob-the-fish installed as well. Would like to be able to use command line navigation keyboard shortcuts such as ctrl-A to get t ...
0
votes
1answer
34 views

Enable Internet-based features in Windows 10 Search

For some reason, internet-based features are not appearing for me in the Windows 10 search box (such as web searches, image recognition searches, etc., though email and contact search does work.). ...
0
votes
1answer
44 views

How to run shell commands after vim commands in command mode?

I know how to run shell comands in vim with :! bang syntax, But how can I done it after vim commands? for example :w!; !echo "some stuff"? I cannot make semicolon and continue with bang. So is there a ...
0
votes
0answers
22 views

Stuck in zsh command trying to load .bash_profile after switching from bash on MacOS

I've just switched from bash to zsh on MacOS and I wanted to load my current .bash_profile so I did: Added #!/bin/zsh to my .bash_profile and ran: % . ~/.bash_profile And I was stuck because of ...
1
vote
1answer
29 views

How do I count number of times that a command has ran and add if condition?

Basically I need to control how fast I upload files to AWS S3 - I have a folder with tens of thousands of files, and this is what I do now: for f in *; do aws s3 cp $f s3://my-bucket; done; What I'd ...
0
votes
0answers
13 views

Use sed command to replace a tag with special characters

URIS='[ "https://%something%/xyz" ]' sed -i "s|REDIRECT_URIS|${URIS}|g" temp sed does not work if I put this command in a shell script; URIs are dynamic and some of them won't have [ or ], while ...
0
votes
2answers
35 views

A simple script for submitting jobs on a server

I'm trying to write a simple script to "submit jobs" on a server without a job queuing system. In bash terminal, I figured I could use commands like nohup to achieve this, e.g.: nohup bash -c 'echo "...
1
vote
0answers
35 views

How to change colors settings via command line in win 10?

Is there a command line to set the color personalization Dark or Light in the Colors settings?
0
votes
0answers
43 views

Make readline edit input command in external editor (similar behavior as “edit-and-execute-command” from bash)

Background So far I've found readline very useful since just by modifying a single configuration file (i.e. ~/.inputrc), you are configuring all those programs that depends on readline. The programs ...
1
vote
2answers
42 views

Can I use bash brace expansion in for loop?

I have some files in directory: touch dir1/dir2/bad\ name{1..4}. I would like to move those files (bad name1 - bad name4) from dir2 to dir1, as well as rename them at once. Because these files have ...
0
votes
2answers
36 views

Script for replacing the file name if it exists?

I'm trying to make a script that changes the name of the file if the file already exists to something like file1.txt, but I keep getting the same error: Syntax error: unexpected end of file So far I ...
0
votes
1answer
41 views

How to let tmux know which shell runs in current pane?

I would like my tmux status bar to show what shell is currently running in the active pane if possible. For the record, I use Ubuntu Server 18.04. I've thought about using the variable #{pane_pid} to ...
0
votes
0answers
17 views

linux command prompt display not working right when using upper arrow to show history commands

I am trying to change my bash PS1 variable to green color on the base name of current directory and white on commands, bellow is my PS1 value: ~ echo $PS1 \e[40;0;32m \W \e[40;0;37m I found if ...
1
vote
1answer
34 views

Command line: merge and keep all info from the two files

How to merge and keep all info from the two files as such ? $ cat file1.txt apple cool dude flan $cat file2.txt apple ball cool dude elephant for a result as such : $cat ...
0
votes
1answer
21 views

Su Into New Environment and Run Command from New User As Alias

I would like to run a su - <desired_user> but then also execute a command. I want to become that user in the new shell but just source a specific file. The desired_user above is a batch user, ...
2
votes
2answers
148 views

How can I list all variables from stdin in for loop?

Having this code: #!/bin/bash for i in $#; do echo ${$i}; done where $# should be number of vars from stdin, gives: ${$i}: bad substitution How to list them without having to write echo $0; echo $...
0
votes
1answer
55 views

shell: test with double bracket [[ does test on file, whereas single [ does not

Having this simple line: user@Host:~$ ls -> fileA fileB user@Host:~$ [[ -d $dir_name ]] && rm * # $dir_name does not exist, empty variable user@Host:~$ ls -> fileA fileB #does not ...
0
votes
1answer
22 views

Binding Alt-Shift-. in tmux

I'm trying to bind some key combinations in tmux, this is what I have in ~/.tmux.conf: bind-key -n 'M-S-.' next-window This doesn't work. How can I bind it? I'm running Konsole in KDE Plasma, ...
0
votes
1answer
58 views

How to append additional text found in a duplicate entry to the original text

I have two files: File#1: aaa bbb ccc ddd eee File#2: aaa,a,a abc,a,b bbb,b,b ccc,c,c def,g,h ddd,d,d eee,e,e fff,f,f ggg,g,g How do I append the data (ex. ",a,a") from file #2 to file #1 only in ...
0
votes
0answers
27 views

How to run two commands at the same time in shell script

I try to implement a command to print the running status of another command. Just like the script below, but I failed. #!/bin/bash printf 'Please wait' ALLDONE=0 command_1(){ sleep 3 ALLDONE=1 ...
0
votes
1answer
24 views

Why is `/bin/ping` not found when in a Bash command-substitution subshell?

I've been trying to set up a bash loop which checks it can ping a remote address: if $( /bin/ping -c 1 x.x.x.x ) ; then echo 'ok' ; fi But I'm getting PING: command not found. I'm not really sure ...
0
votes
1answer
43 views

I can't get echo output from the shell code

I am more new to shell programming and I am encountering such an error. Why does it give such an error? can you please tell me? #!/bin/bash echo "" echo -e " _ _ _ _ _ _" ...
0
votes
0answers
32 views

Sending EOF shortcut: on what does it actually depend on?

It is common knowledge that on Linux to send EOF to a console program you press CTRLD while on Windows you press CTRLZ. However I suspect that this is not actually a feature of the OS, but rather of ...
0
votes
0answers
30 views

killing a process through .sh file

I'm on windows and using MobaXterm to practice UNIX shell scripting. When i just write kill 7232 it kills the process, but when I write it inside a .sh file and then execute the file, it says: ./first....
2
votes
1answer
44 views

Key binding to go up by one directory (in Bash)

In Zsh, I have a key binding to go up by one directory (very useful): # C-M-u: up-directory up-directory() { builtin cd .. && zle reset-prompt } zle -N up-directory bindkey '\e\C-u' up-...
0
votes
1answer
35 views

Long listing format ls command [special character file data]

When using the ls -l command files that are not Character special file (c) or Block special file (b) before the last modification date they have just one number; the file size. Those 2, have 2 number ...
0
votes
1answer
47 views

How can I ignore “\b” and “\e” but not “\n” with echo

First of all sorry for the beginner question, I am quite new to shell scripting. I am creating a simple script to manage my figures for LaTeX documents. Long story short I want to copy \begin{figure} ...
0
votes
1answer
19 views

How can I pass two arguments to `--mail-type` option of `salloc`?

I would like to pass two arguments to an option of a shell command, specifically, for salloc. I can choose to do either of the following salloc -n 1 -t 24:00:00 --mail-type=BEGIN salloc -n 1 -t 24:00:...
0
votes
2answers
51 views

Moving and renaming files recursively

I have the following file structure: root root/year root/year/MM-Month root/year/MM-Month/YYMMTT_Event root/year/MM-Month/YYMMTT_Event/01 Photos/ root/year/MM-Month/YYMMTT_Event/01 Screenshots/ root/...
1
vote
2answers
109 views

Applescript won't move onto next instruction without ending shellscript?

I'm a new user to Applescript and programming in general. I'm trying to create a script that will 1) load a Renpy project through the terminal and 2) then move the resulting project window to a ...
0
votes
3answers
74 views

Need Shell Script To Check If a kernel is over 4.1

I need a script that checks if a kernel is over 4.1 and if it is it runs the script if its not it doesn't, Please help. - Prajwal Something like this but with kernel check if ! [ -x "$(command -v ...
1
vote
0answers
31 views

why ssh-agent and ssh-add commands are not working together in one bash script?

I wrote one script where I would like it to start the ssh-agent first in order to run the agent in background, and sets the appropriate environment variables for the current shell instance. However, ...
0
votes
0answers
22 views

How do I get ZSH to use the colors of my terminal?

I'm in the process of switching over from bash to zsh. My old bash prompt looked something like this: PROMPT_COMMAND=ps1_command ps1_command() { ext="$?" PS1="" if [ "$ext" != 0 ]; then ...
0
votes
1answer
54 views

exec tee to redirect file will create bash process

the script like this : exec &> >(tee -a ./test_tee.log) ping $1 when the script is running in bash 7603, the exec line will create a process which name is 13069. such as the follow: root ...
1
vote
1answer
53 views

What is the info-thingy before the CLI cursor called?

So, in all command lines I've ever seen, there's a little info-thingy at the start of the line before the cursor. CMD just shows your current working directory: PowerShell does the same and also ...

1
2 3 4 5
71