Sponsored Content
Full Discussion: input file names to a script
Top Forums Shell Programming and Scripting input file names to a script Post 302430429 by a_programmer on Thursday 17th of June 2010 02:15:58 PM
Old 06-17-2010
Quote:
Originally Posted by vgersh99
Code:
for file in $@

You might want to use double-quotes around $@, otherwise any file names with embedded spaces will be split into two in your for loop:

Code:
for file in "$@"

Most Unix file-names do not use embedded spaces, but its always good to have your script ready to handle them. Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Reading file names from a file and executing the relative file from shell script

Hi How can i dynamically read files names from a list file and execute them from a single shell script. Please help its urgent Thanks in Advance (4 Replies)
Discussion started by: anushilrai
4 Replies

2. Shell Programming and Scripting

Script for file names/sizes

How can I look at a certain directory and list all the file names, locations and sizes of each file in the current directory and all subdirectories? (2 Replies)
Discussion started by: ssmiths001
2 Replies

3. Shell Programming and Scripting

Bash Script duplicate file names

I am trying to write a housekeeping bash script. Part of it involves searching all of my attached storage media for photographs and moving them into a single directory. The problem occurs when files have duplicate names, obviously a file called 001.jpg will get overwritten with another file... (6 Replies)
Discussion started by: stumpyuk
6 Replies

4. Shell Programming and Scripting

Need script to take input from file, match on it in file 2 and input data

All, I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then Insert file1 column2 to file2 column4 then create a new file. File1: 12345 Sam 12346 Bob 12347 Bill File2:... (1 Reply)
Discussion started by: darkoth
1 Replies

5. Shell Programming and Scripting

Searching for file names in a directory while ignoring certain file names

Sun Solaris Unix Question Haven't been able to find any solution for this situation. Let's just say the file names listed below exist in a directory. I want the find command to find all files in this directory but at the same time I want to eliminate certain file names or files with certain... (2 Replies)
Discussion started by: 2reperry
2 Replies

6. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

7. Shell Programming and Scripting

Script to list the file names in a directory

Hi all, I need a shell script to write into a .txt file the no of files in a directory with extension and separated by comma in between. For eg, a directory contains files like a.csv b.csv c.csv d.csv Then the output in the output.txt file should be like a.csv,b.csv,c.csv,d.csv ... (3 Replies)
Discussion started by: dubuku_01
3 Replies

8. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

9. Shell Programming and Scripting

Script to change file names

I have a landing directory on my unix (solaris) server, that receives the following files: MLH4301I AAOT-hhslog.610.20150805.txt MLH4301I AAOT-hhslog.611.20150805.txt MLH4301I AAOT-hhslog.612.20150805.txt MLH4301I AAOT-hhslog.613.20150805.txt and I need to add to this files the number 10000... (6 Replies)
Discussion started by: fretagi
6 Replies

10. SCO

Long file names within shell script

I am downloading a zip file that contain files that are very long. I am trying to process them, but cannot. I can move the files from one directory to another at the shell prompt, but not within a shell script, I get a stat error. The files look somewhat like this; ... (5 Replies)
Discussion started by: trolley
5 Replies
libcaca-style(3caca)						      libcaca						      libcaca-style(3caca)

NAME
libcaca-style - Libcaca coding style General guidelines A pretty safe rule of thumb is: look at what has already been done and try to do the same. o Tabulations should be avoided and replaced with eight spaces. o Indentation is generally 4 spaces. o Lines should wrap at most at 79 characters. o Do not leave whitespace at the end of lines. o Do not use multiple spaces for anything else than indentation. o Code qui fait des warnings == code de porc == deux baffes dans ta gueule C coding style Try to use short names whenever possible (i for indices, w for width, cv for canvas...). Macros are always uppercase, variable and function names are always lowercase. Use the underscore to separate words within names: #define BROKEN 0 #define MAX(x, y) ((x > y) ? (x) : (y)) unsigned int x, y, w, h; char *font_name; void frobulate_every_three_seconds(void); const is a suffix. It's char const *foo, not const char *foo. Use spaces after commas and between operators. Do not use spaces after an opening parenthesis or before a closing one: a += 2; b = (a * (c + d)); x = min(x1, x2, x3); Do not put a space between functions and the corresponding opening parenthesis: int function(int); A space can be inserted after keywords such as for, while or if, but consistency with the rest of the page is encouraged: if(a == b) return; if (p == NULL) Do not put parentheses around return values: return a + (b & x) + d[10]; Opening braces should be on a line of their own, aligned with the current block. Braces are optional for one-liners: int function(int a) { if(a & 0x84) return a; if(a < 0) { return -a; } else { a /= 2; switch(a) { case 0: case 1: return -1; break; default: return a; } } } C++ coding style Nothing here yet. Version 0.99.beta18 Fri Apr 6 2012 libcaca-style(3caca)
All times are GMT -4. The time now is 01:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy