Skip to main content

All Questions

Tagged with
-2 votes
0 answers
27 views

Creating in Linux files in GB or MB range by various size by read a file

In Linux with Bash, there is the File numbers_in_one_line. In this file there is only one line with several numbers, all separated by spaces. These numbers are the value in bytes for creating files ...
user447274's user avatar
0 votes
1 answer
103 views

How to compare output of a program with a reference value in a shell script?

I have my own implementation of a Redis server which I'd like to test through a shell script. The general idea is to feed it with some commands through nc, and since nc prints the output of my program ...
ivanbgd's user avatar
  • 111
4 votes
1 answer
162 views

Run in background avoiding any job control message from the shell [duplicate]

Lets define a shell function (here the shell is Bash) and test it $ s () { xterm -e sleep 5 & } $ s [1] 307926 $ [1]+ Done xterm -e sleep 5 $ With my specific meaning of ...
gboffi's user avatar
  • 1,336
0 votes
2 answers
97 views

How to redirect output from a program that waits for input

Following this post I created my own version of the script, with the difference that user and password are forwarded from the environment variables: #!/bin/zsh pamtester login $user authenticate <&...
Namal's user avatar
  • 101
3 votes
1 answer
151 views

Bash redirections - handling several filenames specially (man pages)

Please confirm/correct me. I've found related Duplication of file descriptors in redirection but that does not answer my specific question. From the The GNU Bash Reference Manual, section 3.6 ...
Martian2020's user avatar
  • 1,353
0 votes
0 answers
46 views

Shell script not behaving as expected expanding variable as command [duplicate]

I am trying to script a job which interacts with mysql. I am using a variable to store a long command line. But when run via a script this does not behave as expected. I can reproduce the issue as ...
symcbean's user avatar
  • 6,225
0 votes
1 answer
42 views

What is (if any) the file descriptor of /dev/tty?

The urgent issue to read keyboard input in the pipeline is solved by the answer in https://stackoverflow.com/questions/15230289/read-keyboard-input-within-a-pipelined-read-loop: mycommand-outputpiped |...
Martian2020's user avatar
  • 1,353
0 votes
1 answer
62 views

Why is the logic handled differently in rsync '--delete src/*', '--delete src/' and '--delete src/.'

I want to copy and synchronize directories using rsync with --delete or --delete-excluded in a bash script or shell on a Debian system. The directory was not synchronized at first, meaning the deleted ...
ReflectYourCharacter's user avatar
1 vote
1 answer
66 views

How can a bash script determine how it was started? [duplicate]

I am running various scripts on Debian 12.X currently with the following bash: GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) I have the following methods/options to execute the script. ...
ReflectYourCharacter's user avatar
0 votes
2 answers
91 views

Bash script, execute while command isnt outputting value

I'm trying to write a bash script (very new to writing them btw) on a Linux system, and I basically want it to execute a command every say 5 seconds while another command isn't outputting a value. So ...
Tamrak's user avatar
  • 3
8 votes
1 answer
237 views

bash or ksh 'vi' mode - How to jump to end of history (most recent command)?

I am a long time ksh user, and use bash under duress - both in 'vi' editing mode. One thing that has always niggled - after searching back through history for a command (.e.g <Esc>/needle), how ...
Annihilannic's user avatar
0 votes
5 answers
128 views

Move/mark files and the associated-part too

There is a folder with many files in it: 112.mkv 123.md5 123.mkv 221.mkv 467.mkv aa1.mkv abc.md5 abc.mkv bbc.mkv dde.md5 dde.mkv ggh.mkv .... xxy.md5 xxy.mkv xxz.mkv How can I move .md5 files and the ...
user447274's user avatar
7 votes
2 answers
1k views

Having trouble with #!/bin/sh -h as the first line in a bash script: /bin/sh: 0: Illegal option -h

I have two systems, the file is the same. It works in openSuse, but having trouble in Ubuntu. The top of the script says: #!/bin/sh -h I updated bash to match on both systems to match what is on ...
Sblu's user avatar
  • 71
0 votes
2 answers
61 views

Kill current bash shell and start a new one with some command

is it possible to kill/exit the current bash shell and start a new one with some command? Something like kill -9 $PPID && bash -c echo 'I started new!' which does not work obviously.
Juergen's user avatar
  • 101
0 votes
1 answer
51 views

Why is bash expanding `[--x]` to `f` only when I’m in my home directory? [duplicate]

I'm observing a behavior in bash that only happens in my home folder. I haven't been able to reproduce it on any other machine or in any other folder. $ echo --one [--two] --three --one f --three $ # ...
wobtax's user avatar
  • 672

15 30 50 per page
1
2 3 4 5
278