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
1 vote
1 answer
3k views

What is the shell exactly when using Cmder on Windows?

I've just started using Cmder on Windows 7 and I understand that is a console emulator for Windows which gives a better experience than using cmd. However as I understand it the emulator needs to run ...
user20010's user avatar
1 vote
1 answer
1k views

Antigen failing to load theme from .zshrc

I have a fresh Debin Bullseye installation and I can't get antigen to load a theme if loading it directly in .zshrc. I installed zsh and zsh-antigen using apt. My minimal .zshrc: source /usr/share/zsh-...
leviathan's user avatar
  • 216
1 vote
1 answer
329 views

Shell appending unknown integer to hostname in prompt (zsh) on mac

I recently customized the prompt in my terminal to be more like the one from parrot os, which I really like. I have read over the documentation many times on how to use the markers/variables in the ...
Digital Brent's user avatar
1 vote
2 answers
1k views

How to understand what this sfdisk command is doing

In this command what is happening? I tried to know but what are these numbers and parameters 2048,,0x0C,-? sfdisk -u S -L -q ${RAW_FILE} 2>/dev/null << EOF 2048,,0x0C,- EOF
user avatar
1 vote
1 answer
3k views

Passing variables to docker run from within a bash shell, getting "unterminated quoted string" error

I have a bash shell with multiple variables that form the command options of a docker run command. I suspect a < character is breaking the config line that I am passing. This is the command that I ...
Richard Westby-Nunn's user avatar
1 vote
1 answer
510 views

-v unary conditional expression isn't working

I want to check if the given variable is set with the -v check. I'm struggling to understand where the error is coming from. Having the following script in a file var-test.sh: MY_VAR="test" ...
mjarosie's user avatar
  • 113
1 vote
1 answer
114 views

Understanding Operators in find command

[kony@HOSTNAME testing]$ pwd /apps/kony/fmw/testing [kony@HOSTNAME testing]$ touch SCCS [kony@HOSTNAME testing]$ touch NOT_SCCS [kony@HOSTNAME testing]$ [kony@HOSTNAME testing]$ find . -name SCCS -...
rizwan's user avatar
  • 189
1 vote
1 answer
527 views

How does exec interact with pipes in shells?

Assume I have the following in the beginning of my code: exec < file It means, if I understand correctly, that all commands trying to read from stdin will actually read from file. But if I have ...
confused_bash_user's user avatar
1 vote
1 answer
282 views

loop through subdirectories and ffplay all mp3 files

hi i'm trying to iterate through subdirectories and ffplay all MP3s in subdirectories, but i keep having only one track playing after it stops, here is my code #!/bin/bash shopt -s globstar nullglob ...
madiha bout's user avatar
1 vote
1 answer
397 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 ...
user3768495's user avatar
1 vote
1 answer
738 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, ...
LetMeSOThat4U's user avatar
1 vote
2 answers
2k views

Getting rid of "command not found..."

When I mistype command in terminal I got this error: bash: XX: command not found... After that, I have to wait or use keyboard interrupt before I can use prompt again. Sometimes shell offers me to ...
EFK's user avatar
  • 25
1 vote
3 answers
805 views

MacOS Terminal: Control+C "hijacked". Terminal outputs ^Z when I click Control+C

I seem to have a peculiar issue with MacOS Terminal (or iTerm) from time to time and I cannot pinpoint the cause. Whenever I need to kill a program in Terminal, Control + C doesn't work. Terminal ...
Max's user avatar
  • 71
1 vote
1 answer
1k views

How do I run tesseract (anything really, that requires write permissions, from a shell) on windows10?

I am trying to run tesseract on windows10 (home ed), but this question is really more generic. Sources and instructions to run the program are here. I am running a downloaded windows binary, not a ...
Buck Thorn's user avatar
1 vote
2 answers
777 views

How to list all files of a directory along with an index to allow users to choose file by inputting the index number?

I have multiple files in a directory and I am working on a bash script to list down all the files along with an index next to them so that the users can choose which file to select on the basis of the ...
loadbox's user avatar
  • 637
1 vote
1 answer
85 views

Simple if/elif/else bash program with READ

The following code always ends up in the else part - also if I enter "peter" or "root". I do not get a syntax error. What am I doing wrong? #!/bin/bash # Hello World bash script echo "What is your ...
Janothan's user avatar
  • 113
1 vote
1 answer
120 views

Shell - Is *${i,,}* correct and what is it for?

I am reviewing a shell script and found this lines : DIR=/home/bot/REP_INV/ LIST=/root/ListeTRI.txt ... ligne=`cat $LIST` for i in $ligne do /bin/cp $DIR*$i* /root/$i/InvExt/ /bin/cp $DIR*${...
Charly Roch's user avatar
1 vote
1 answer
2k views

handling of space and newline

Assuming user has 5 processes started, what is queried with below sentences: cuser=`whoami` a="`ps -C process -o user= | grep $cuser`" echo $a user user user user user vs. echo "`ps -C process -o ...
user1070696's user avatar
1 vote
1 answer
67 views

list of on-demand shell variables?

tl;dr where can I find a list of shell variables that are on-demand (not listed by env) Variables like $OSTYPE or $COLUMNS (bash) or $RANDOM (bash) are not listed by env. Where can I find the list ...
JamesThomasMoon's user avatar
1 vote
1 answer
126 views

Not able to run a command through ssh

I am running a command on a FreeBSD machine (xxx.yyy.zzz.net) and getting the output command sudo camcontrol devlist | grep -o 'ada[0-9]' | while read -r a ; do sudo camcontrol identify $a | grep ...
Ram's user avatar
  • 13
1 vote
2 answers
8k views

What's the different between 'cat > some_file << EOF some_stuff EOF' and 'echo "some_stuff" > some_file'

This is a question of knowledge respectively research. I'm not quit clear why I should use this code: cat > $FILE << EOF command1 $var_this_routine command2 \$var_attached_routine ... EOF ...
Silerra's user avatar
  • 13
1 vote
2 answers
2k views

Clear multi-line input in IPython

The current line on the IPython prompt can be cleared with the keyboard shortcut Ctrl-U. Is there any shortcut that clears all lines on the IPython prompt in one go?
JJS's user avatar
  • 11
1 vote
1 answer
76 views

Move a range of numbered files and change their value

I've got numbered files (DSC_0001.jpg to DSC_0065.jpg), I know how to move them with mv DSC_{0001..0065}.jpg dir. I have no idea how to move them and change the range of values. mv DSC_{0001.....
b31eed0485's user avatar
1 vote
1 answer
304 views

Move folders containing files with extension

Example folder structure: ➜ test tree . ├── testflac1 │   ├── track1.flac │   ├── track2.flac │   └── track3.flac ├── testflac2 │   ├── track1.flac │   ├── track2.flac │   └── track3.flac ├── ...
w1kl4s's user avatar
  • 25
1 vote
1 answer
221 views

How to quit a non-login shell?

e.g. I use ssh to login into a Linux server with zsh. Then in the zsh, I type zsh to get a non-login shell. How can I quit the non-login zsh and get back to the login zsh?
youkaichao's user avatar
1 vote
1 answer
122 views

what is bash command `command` used for and what is it when it appears in shell script

when I was writing a shell script, I happen to know command is a reserved word. Then I noticed command is also a bash command. command ls gives the same result as ls. command ls | grep xxx gives the ...
Tiina's user avatar
  • 3,177
1 vote
2 answers
795 views

Is it POSIX-compliant to use a shell function in a pipeline?

Is it possible to use a shell function in a pipeline? Say I had a function that acted like grep, called mygrep. Is there any way, using only POSIX shell features, to be able to invoke mygrep like ...
Tim Bird's user avatar
  • 113
1 vote
1 answer
73 views

How to extract multiple urls from String?

I have a string like below https://website.com/BTAE/2015/BTAE assignment jan 15.pdf²0ÔË'\„QI„"ÙP¾^ŒŸZ‡@Æ*]Ü.^‚vðƒ€Ù¾»Æš©Šñ‘€é• ªÂIR#œÉgÉÛ^gMdÉ%9¬e˜Hžôb¿'0<ô ?lþzk…éÃÄórÈ;EW¦K³1…²ì¶ZFžŠÒô*ÄÖ\...
Aabir Hussain's user avatar
1 vote
1 answer
859 views

urban legend : why is it better to avoid using file descriptor 5?

In the answer to this question, the answerer quoted a block of scripts, which contains a line like this exec 4>/path/to/output.file #and a third, for reading and writing, with FD 6 (it's not ...
Sajuuk's user avatar
  • 451
1 vote
1 answer
318 views

shell command on matching line (in vim: combine the global `:g` or `:v` command with shell command)

I want to use a shell command (fmt in this case) to operate on every (non-)matching line of a regex in a file. I'd prefer to do it within vim! I am, nonetheless, open for a pure shell/bash/zsh ...
nox's user avatar
  • 216
1 vote
1 answer
2k views

can't increment a variable inside a loop in a bash script

I am running a bash script in Ubuntu 18.04. The script needs to run a python script 10 times. I did the following testbash.sh script: #!/bin/sh count=1 while [ $count -le 9 ] do python /home/e/...
user9371654's user avatar
  • 1,207
1 vote
1 answer
832 views

Bash: Copy a list of files that contain (lots of) special characters

I'm well aware of how to simply copy a list of files to another location using bash, but the problem is that my list of files contains filenames that contain just about EVERY character that needs to ...
user2634928's user avatar
1 vote
2 answers
1k views

Need to skip the HomeDirectory permission check on remote machine for the ssh client .How to set StrictModes off for a specific host in ssh client?

I am trying to connect to a remote machine over ssh in a passwordless manner using ssh-keys .But it is failing to connect without password due to the permission on the remote server home folder (777) ....
Mathews Jose's user avatar
1 vote
1 answer
579 views

Encryption compatibility between TCL and openssl

I have a shell script and a tcl script using encryption mechanism and want to have a same cipher output from both the scripts. for example, the output cipher of tcl script and shell script should be ...
Aditya Mayank Shankar's user avatar
1 vote
1 answer
51 views

less -z option: the manpage refers to it, but does not document it

Simply put, what does the -z flag to less do? In the prezto (zsh shell) config, the $LESS env var is set with flags and the last one is -z-4. What does this do? Is there a version of a less manpage ...
Steven Lu's user avatar
  • 3,668
1 vote
2 answers
30k views

Execute Shell Commands from Excel Cell

I have a shell command, to execute a program with additional arguments. Shell "C:\Program Files\uvnc bvba\UltraVnc\vncviewer" & " " & Range("$G3") The cell G3 contains an IP address I wish ...
Thom G's user avatar
  • 93
1 vote
1 answer
373 views

pass the result of command to another in batches

Lets say command1 results an array of 10000 value, I want to pass this result to command2 in 20 patches, 500 value each. What I have now command1 arg $(command2 arg)
iShaalan's user avatar
  • 293
1 vote
1 answer
4k views

Change color of hostname in Fish shell prompt

I'm migrating to a new Mac, and I'm having trouble setting up my shell to match the old one. Old: New: Notice the host color is different? I copied the entire .config/fish folder over to the ...
brandonscript's user avatar
1 vote
1 answer
1k views

What is '-f option' in zsh

I am trying to understand when is .zshenv source and in manual both in terminal and online is mentioned that .zshenv is sourced on all invocations of the shell, unless the -f option is set ...
ps-aux's user avatar
  • 3,745
1 vote
1 answer
2k views

Special characters in the shell

I know that some characters like " or * need to be escaped to mean its literal value. I wonder if is there any definitive set/list of all of them?
Mulligan's user avatar
  • 689
1 vote
1 answer
1k views

Chatting using Bash Shell?

The origins of the questions trace back to Mr. Robot series, where I noticed that people join "group" or "parties" chat through Bash Shell to communicate with other people or group. Then I got ...
arthrax's user avatar
  • 23
1 vote
1 answer
826 views

Pipe in Environment variable in fish shell doesn't execute the first command?

I want to set fish_greeting to date --rfc-2822 | cowsay -f tux | lolcat (don't judge me). When I run date --rfc-2822 | cowsay -f tux | lolcat interactively, I get the proper output (the date in a ...
ZuluDeltaNiner's user avatar
1 vote
1 answer
4k views

How to pass array to bash shell script?

How do I pass an array as a variable from a first bash shell script to a second script. first.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') sh second.sh "$AR" # foo sh second.sh "${AR[@]}" # foo ...
Mowzer's user avatar
  • 2,289
1 vote
1 answer
1k views

Accessing array index variable from bash shell script loop

I want to access the array index variable while looping thru an array in my bash shell script. myscript.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') for i in ${AR[*]}; do echo $i done The result ...
Mowzer's user avatar
  • 2,289
1 vote
1 answer
99 views

Access to line arguments in shell script

I wonder if there is possible to access full command line call in shell script. In my script I need to pass it further. I find that there are $@ and $* accessors, but it do not pass all the characters,...
bladekp's user avatar
  • 259
1 vote
1 answer
2k views

Using shell (bash) to determine key for value from file

I am scripting some application deployment and deploy promotion processes using bash (shell). These scripts are being written as a failsafe in case our CI platform ever fails again (as it has recently)...
Chris Giddings's user avatar
1 vote
1 answer
2k views

Changing sh color in .bashrc

I'm trying to change the color of my shell which I connect to using Putty. When I type this export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h:\w\$ ' I get exactly what I want. ...
bytecode77's user avatar
  • 1,141
1 vote
2 answers
89 views

Import previous commands to edited command

I'm playing with zsh to change image modification time according to the 'Date/Time Original' exif attribute. For this I one command I do: PDATE=$(exiftool -p '$DateTimeOriginal' $PIC | sed 's/[: ]//...
Jakub's user avatar
  • 171
1 vote
1 answer
11k views

Terminal 'last' command doesn't display login history

The last command in Terminal (on Mac OS X 10.11.2) is supposed to display a list of login history. However, when I type it in, all I get is user$ last wtmp begins Mon Jan 11 13:17 user$ last user ...
Honesty's user avatar
  • 59
1 vote
2 answers
9k views

How to get HTML file as a content to mail (shell script)

I am new to shell script, I have an HTML file which contains table data. Now I need to send this file to mail. mail -s "test" abc.com <test.html Currently I am getting the raw HTML code for the ...
Theja's user avatar
  • 11

1
38 39
40
41 42
82