Problem when concatinating wildcard onto file location in bash script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem when concatinating wildcard onto file location in bash script
# 8  
Old 09-28-2010
Above the shell globbing, try

Code:
set +o noglob

# 9  
Old 09-28-2010
Quote:
Originally Posted by Corona688
Above the shell globbing, try

Code:
set +o noglob

I'm afraid I don't know what the shell globbing is, but I tried it in the script and in the terminal prior to running the script, and I have the same problem.
# 10  
Old 09-28-2010
The noglob is a bash-specific shell option that's fairly self-explanatory. I thought maybe it'd gotten turned on somehow.

In the script,

Code:
echo ~/data/${1}*

...then copy-paste the resulting output into your shell to see if it expands there. If it doesn't there's a subtle typo.
This User Gave Thanks to Corona688 For This Post:
# 11  
Old 09-28-2010
Try this
bash code:
  1. #! /bin/bash
  2. filelist=${1}*
  3. cd ~/data
  4. ~/./convertFile $filelist ~/temp/output
# 12  
Old 09-28-2010
Okay, I feel stupid. It turns out that it was expanding, but there was actually a file called "aaaa*" in the directory, which meant that the first record in the expansion was "aaaa*", and this in turn made it look like all convertfile was getting was the unexpanded string. Thanks so much for your help!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Wildcard in bash script

Hi there, I am pretty new to linux scripting so .. I am writing a script to loop through all my directories of sequence files in order to do stuff with them (trimming, normalizing, stuff that one would do with sequence files). Here I need to pick out files that match each other. The files... (10 Replies)
Discussion started by: jahndavik
10 Replies

2. Shell Programming and Scripting

How to find a existing file location and directory location in Solaris box?

Hi This is my third past and very impressed with previous post replies Hoping the same for below query How to find a existing file location and directory location in solaris box (1 Reply)
Discussion started by: buzzme
1 Replies

3. Shell Programming and Scripting

Difficult problem: Complex text file manipulation in bash script.

I don't know if this is a big issue or not, but I'm having difficulties. I apoligize for the upcoming essay :o. I'm writing a script, similar to a paint program that edits images, but in the form of ANSI block characters. The program so far is working. I managed to save the image into a file,... (14 Replies)
Discussion started by: tinman47
14 Replies

4. Shell Programming and Scripting

Bash script to read file location

I'm writing a bash script that reads a file location from a user, and I'm wondering how to get the script to accept tab to auto complete the directories that are input. (8 Replies)
Discussion started by: Prodiga1
8 Replies

5. Shell Programming and Scripting

wildcard in bash shell script

I tried to use the wildcard '*' in my bash script, but I can not get it work. Here is a simple example (list file names in current directory): ls ./* does not work in my bash script. But it works if I use ls ./ So is there any special syntax to use '*' wildcard in bash script (I tested the... (11 Replies)
Discussion started by: aerosols
11 Replies

6. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

7. Shell Programming and Scripting

concatinating the string in each line of the file

how to concatenate particular string in each line of a file.. root$cat conf check_11043 heartbeat_4345 ---------- if i want to add the string "done" output of the file should be check_11043 done heartbeat_4345 done (1 Reply)
Discussion started by: mail2sant
1 Replies

8. Shell Programming and Scripting

Bash copy file contents into an existing file at a specific location

Hi all I need to copy the entire contents of one file into an existing file at a specific location. I know the exact line number where I need to put it. It appears I would use either sed or awk to do this, but I have been unsuccessful so far: File A line 1 line 2 line 3 line 4 ... (6 Replies)
Discussion started by: gshepherd7
6 Replies

9. UNIX for Dummies Questions & Answers

Bash Wildcard Question

Hi, I am writing a BASH script. In a directory I have a bunch of files of various filename structures. How do I list all the filenames that begin with either a capital or lowercase A or T. Is there one command that could replace the following 4: ls A* ls a* ls T* ls t* Thanks. Mike (3 Replies)
Discussion started by: msb65
3 Replies

10. Shell Programming and Scripting

globbing, $# is too high after wildcard expansion in bash script

How can I pass in an argument such as "*.k" to a bash script without having to double-quote *.k and not having *.k `glob` to match all files in the pattern? I tried using noglob in my script but this didn't work the way I thought it would.. expansion is still occuring, $# is higher than I... (3 Replies)
Discussion started by: zoo591
3 Replies
Login or Register to Ask a Question