Linked Questions

0 votes
2 answers
224 views

I am trying to use useradd. I found an example of something I'd like to try and incorporate, though I can't understand specific parts. Here is the example in entirety: if [ $(id -u) -eq 0 ]; then ...
Gee_k's user avatar
  • 27
3 votes
1 answer
125 views

How can I force a re-evaluation of this each time? cat > $(date '+%H-%M-%S').log So that when I first output something it gets written to one file, and after a few seconds I make another ouput and ...
Markus's user avatar
  • 149
0 votes
2 answers
107 views

I am trying to bulk rename many folders but for some reason my approach does not seem to work. I am trying to use the following script but it does nothing. I am new to programming so any suggestions ...
ranjit abraham's user avatar
0 votes
2 answers
150 views

I want to extract part of string in a variable as below, but it returned bad substitution. for i in `ls`;do echo ${i|cut -d. -f1};done -bash: ${i|cut -d. -f1}: bad substitution In my scenario, I ...
DennisLi's user avatar
  • 111
0 votes
1 answer
83 views

How do you append $@ or $* , each as a new line to a file? I think I already searched for that before. Adding a new option -i --insert-newline with possible values 1, 2, 3 or Linux, Windows, Mac to ...
Laurent Lyaudet's user avatar
0 votes
3 answers
95 views

The following code prints "Odd" no matter what number I put in, why doesn't it print "Even" when given an even number as an argument? if [[ 'echo "$1%2" | bc' =~ 0 ]] then echo "Even" else ...
smeepy's user avatar
  • 3
1 vote
1 answer
121 views

I am trying to remove files from a directory by pasting their names into a while loop that will simply rm each item from the list of files given to it. $ sponge | while read file; do echo "rm $...
ychaouche's user avatar
  • 1,043
0 votes
3 answers
101 views

I'm attempting to write a bash script to check multiple files for a string, then if the string is found to remove it. Here is what I have, which I thought would work, but is only partly. The entries ...
d1530's user avatar
  • 1
1 vote
1 answer
62 views

So this is my first function: #!/bin/bash lets_print () { echo hello $1 } lets_print Earth lets_print Mars ready to show result user@bash$ ./demo.sh Hello Earth Hello Mars And this is my ...
Denny's user avatar
  • 261
0 votes
2 answers
141 views

I have variable x2 having 08PKj00000YdniC 09:59:04.53 (130409269)|SYSTEM_METHOD_EXIT|[25]|System.debug(ANY) ... many other lines from logs below I am trying to take the first line and discard ...
Patlatus's user avatar
  • 123
0 votes
1 answer
177 views

I have a file named "-diary.txt-", I need to get it's content. When trying to read it using echo < "-diary.txt-", it returns a blank string. I did some research, and came up ...
Nikita Re's user avatar
0 votes
1 answer
53 views

I am trying to understand what the second echo statement does exactly (it's an existing script).. echo "Triggering report.. " curl -s -X POST "http://aaa.bbb" echo -e \ '\ ' I ...
Teddy's user avatar
  • 103
0 votes
1 answer
110 views

I am trying to make a functional script just using Partition Label, get that label, from the Label get the Device, and pass fsck -fy twice on each partition. #!/usr/bin/env bash # Filter partition by ...
Inukaze's user avatar
  • 47
0 votes
1 answer
138 views

How do I set a variable in Bash Zsh with a single dash (-)? None of these work: x=- x=\- x='-' EDIT: this seems to work fine in Bash, I was testing this with echo in Zsh which doesn't work.
Subbeh's user avatar
  • 430
1 vote
1 answer
67 views

I wanted to add to my hosts file easily using a one line command, but I get an unexpected result. $ sudo sh -c 'echo -e "10.0.10.0\tserver.bananas.com\tserver" >> /etc/hosts' $ cat /etc/hosts -...
paradroid's user avatar
  • 1,265

15 30 50 per page