Solved

passing parameters

Posted on 2006-10-27
2
276 Views
Last Modified: 2010-04-21
If I pass parameter that has <space> in between them, is there a simpler way to do it.
Hard coding inside the body of the script does work

$cat test.sh
for i in `fgrep -n $2 $1|cut -f1 -d':'`
....
...

If I pass parameter like the following, it fails

test.sh filename.sql "SOME STRING"

If I hard code test.sh as the following it works:

for i in `fgrep -n "SOME STRING" filename.sql|cut -f1 -d':'`
....
....
0
Comment
Question by:josephsonnd
2 Comments
 
LVL 45

Accepted Solution

by:
sunnycoder earned 125 total points
ID: 17820886
Hi josephsonnd,

Use double quotes inside script too

for i in `fgrep -n "$2" "$1"|cut -f1 -d':'

Cheers!
sunnycoder
0
 

Author Comment

by:josephsonnd
ID: 17821594
Thanks very much!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now