Skip to main content

All Questions

Tagged with
2 votes
1 answer
4k views

Cannot stop bash to expand star (wildcard character) passed to app from shellscript

I have a shell bash script wich should pass the star ["*"] wildcard character to an application without using quotation marks. I am reading since hours and always find to use "set -f" inside the ...
mabra's user avatar
  • 161
0 votes
1 answer
1k views

globbing and wildcards

Are wildcards ever supposed to be expanded for a program that is not the first in the pipeline? Every example uses wildcard for the first program in the pipelilne. For example, the following does ...
Niklas Rosencrantz's user avatar
9 votes
1 answer
1k views

Why does `grep fil*` fail?

I found echo file|grep fil* fails, but echo abcd|grep abc* succeeds. I don't understand it, can someone explain?
tmpbin's user avatar
  • 783
4 votes
2 answers
159 views

confusing about double quoting

I learned when I use command, double quoting treat all things as character except $, `, \ . But, when use command like find -type f -name "*.jpg" *.jpg is inside double quotes. Then, it means we want ...
A.Cho's user avatar
  • 469
2 votes
1 answer
2k views

Globbing error due to whitespace

My directory variable POSTMAP="/work/Documents/Projects/untitled\ folder/untitled\ folder/*/*_tsta.bam" My for statement: for file0 in ${POSTMAP}; do ... It seems that the whitespace in 'untitled ...
ozarka's user avatar
  • 287
4 votes
4 answers
3k views

How to escape shell metacharacters automatically with `find` command?

I've got a bunch of XML files under a directory tree which I would like to move to corresponding folders with the same name within that same directory tree. Here is sample structure (in shell): ...
kenorb's user avatar
  • 21.3k
6 votes
2 answers
8k views

How to store a path built with wildcards and containing with spaces into a variable

Here's the situation (I'm on a Mac, OS X El Capitan): # This works: $ cd /Applications/Adobe\ Illustrator*/Cool\ Extras.localized/en_US/Templates/; # These do not work: $ INSTALL_DIR=/Applications/...
mhulse's user avatar
  • 1,809
1 vote
1 answer
119 views

find command match issue [duplicate]

I'm having some trouble while searching files with find command and the way it handles the search. Let's say I'm currently in the directory /tmp and the directory contains the files: backup-20151219....
Daichi42's user avatar
2 votes
1 answer
1k views

bash regex: asterisk gives ambiguous search results with grep

I am using a simple text file to test the * meta-character through grep. The text file is as below: 1 11 111 1111 11111 111111 d da daa daaa b bc bcc bccc Now when I search digit 1 using grep like ...
Sudhish Vln's user avatar
1 vote
2 answers
1k views

Internal expansion with the find command and wildcard character [duplicate]

I'm still learning the command line and I am having some trouble fully understanding the use of the wildcard within the find command. I'm working in the directory user/temp and use the find command ...
rriera96's user avatar
1 vote
1 answer
514 views

Having trouble with img2pdf and spaces in filenames

I am trying to convert a bunch of jpeg files to a pdf file. When I type the filenames with the quotes all is fine: $ img2pdf "./Page 001.jpg" "./Page 002.jpg" -o book.pdf When I go for the ...
Maxime Vernier's user avatar
3 votes
3 answers
3k views

Why are square brackets preventing shell expansion?

'4800483343' is a directory, and 'file1' & 'file2' are two files in it. Why is the following happening? $ ls 4800483343 file1 file2 $ md5sum 4800483343/* 36468e77d55ee160477dc9772a99be4b ...
EmmaV's user avatar
  • 4,087
3 votes
4 answers
4k views

Bash: move files of specific pattern

I write a script that iterates over a set of zip files, extracts them and moves only files that match a specific filename pattern to another folder. The script: #!/bin/bash ARCHIVE_FILEMASK="????-??...
twenty7's user avatar
  • 87
2 votes
2 answers
1k views

Cannot run command inside bash variable including square brackets with nullglob

Assuming I want to run commnand stored inside the variable with nullglob turned on. For example: shopt -s nullglob a="echo [foo]bar" ${a} This gives me an empty output due to the nullglob option of ...
krab1k's user avatar
  • 23
-1 votes
1 answer
636 views

Assign regular expression as character for a variable

I am wondering is there is a way to assign a regular expression as a character in a string to a variable and not have the regular expression change my variable. For example: in my directory I am ...
ucr's user avatar
  • 1

15 30 50 per page