Linked Questions

0
votes
0answers
31 views

awk output not in columns when moved to log [duplicate]

I have an awk command piped to the output of another command | awk {'print $2,$3'}. When I run this command the output displays the data in columns, of the columns as I would expect column2 column3 a ...
0
votes
1answer
56 views

Help me understand a script that uses csplit and sed

I wanted a simple way to export notes from the reference manager, Zotero. I start by selecting multiple notes and dragging them into a blank text file. I also want achieve "atomicity" of my ...
1
vote
3answers
63 views

Output of find differs between direct invocation and bufferin in shell variable

I have come across some odd behaviour while using the find command that I cannot find an explanation for. I have a .txt file with 1 filename per line and I am using the find command to recursively ...
3
votes
3answers
5k views

Making associative array based on another associative array

I made an associative array as follows. To give a few details, the keys refer to specific files because I will be using this array in the context of a larger script (where the directory containing the ...
0
votes
2answers
56 views

Using grep in a variable in a loop

I'm having trouble storing a grep result as a variable in a loop. while read file;do Server=$(echo $file | awk '{ print $1 }') FDate=$(echo $file | awk '{ print $2 }') ST=$(cat foobar | grep $...
0
votes
2answers
33 views

looping through a folder which has spaces, passed as an argument in a bash script

I've read a ton of answers that are close to what I need, but not exactly, and I can't figure out how to adapt them to my needs. I'd like to take write a bash script that takes a source folder as an ...
0
votes
0answers
39 views

script in bash two if condition and print in for loop

I'm learning to script in bash, trying to solve a little exercise. The exercise is this: If the variable named "basenew" contains the contents of the variable named "valuebase". &...
0
votes
0answers
36 views

Directories printed instead of */ [duplicate]

I have a file like this /* Created by Bla bla bla Copyright by XYZ December 20th, 2020 */ "car" = "Carro"; "door" = "Porta"; I would like to read ...
0
votes
0answers
19 views

Difference between echo $(cal) and echo "$(cal)" [bash] [duplicate]

I'm a linux noob. When I type echo $(cal) in bash it prints calendar without any formatting. But when i type echo "$(cal)" it prints the complete formatted calendar. What is the distinction ...
1
vote
1answer
42 views

find command with multiple directories

Does find allow multiple directories and should they be quoted. find "${dirlist[@]}" "${ftype[@]}" -type f
0
votes
1answer
38 views

rsync exclude not working in shell script

I have this minimal working example of shell script that won't exclude cache directory. #!/bin/sh SRC_DIR="/home/" DEST_DIR="/backup/test" OPTSTR="-avzHAXx --delete --exclude ...
0
votes
1answer
58 views

Problem is "too many arguments" [closed]

First of all, I will leave the code I wrote below, but I would like to tell you a problem I had before. Problem 1 : I get the error "too many arguments" when I type any character and leave a ...
4
votes
3answers
180 views

How to align the output generated in a shell "for" loop by columns

I'm trying to align output from a bash for loop. Currently, I'm getting output from my loop that looks like so: Directory: /some/long/directory/path Remote: some-remote Directory: /some/dir/path ...
0
votes
1answer
32 views

Why is my bash variable not expanded when used in this variable assignment?

I'm working to make a small script to transfer some files with rsync. I'm stuck with a variable issue. I have the folder: /home/folder_1/, which have the folders 20210725, 20210726, 20210727 and ...
1
vote
1answer
46 views

What is ${@} in bash? [duplicate]

Recently I was learning bash commands in Linux, specifically string manipulation. In that there was a local variable declared to be equal to ${@}. I understand that $n refers to the nth command line ...

15 30 50 per page
1
2 3 4 5
15