LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-15-2013, 01:26 PM   #16
ntubski
Senior Member
 
Registered: Nov 2005
Distribution: Debian, Arch
Posts: 3,780

Rep: Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081Reputation: 2081

Quote:
Originally Posted by danielbmartin View Post
When I enter /home/daniel/Desktop/LQfiles/dbm684.bin the result is bash: /home/daniel/Desktop/LQfiles/dbm684.bin: Permission denied
You need give execute permission for the file (chmod +x /home/daniel/Desktop/LQfiles/dbm684.bin).

Quote:
It's unclear what benefit is obtained by the #!/bin/bash
The benefit is that the person/program executing the file doesn't need to know which interpreter to use because it's encoded in the file itself.
 
Old 03-15-2013, 03:22 PM   #17
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
Quote:
... so your Path= and mine are not equivalent.
I was on the assumption that you start the program from the directory where the datafiles are.
While you are on the assumption that the data files are in the same directory as the script.
I assumed the OP's shell doesn't support the direction operator and tried to find substitutes for it.
offtopic I just installed Centos for RHCE qualification. What a terrible installer it has if you don't want a standard install.
 
Old 03-15-2013, 03:40 PM   #18
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
Quote:
Originally Posted by whizje View Post
While you are on the assumption that the data files are in the same directory as the script.
Not an assumption, it is a requirement (unless you change the file definitions in the code).

Daniel B. Martin
 
Old 03-15-2013, 04:08 PM   #19
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
Quote:
Not an assumption, it is a requirement (unless you change the file definitions in the code).
Ok do you have a alternative for the redirection operator.
 
Old 03-16-2013, 10:10 AM   #20
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
Quote:
Originally Posted by whizje View Post
Ok do you have a alternative for the redirection operator.
The file identifier for my program is /home/daniel/Desktop/LQfiles/dbm678.bin
The input files, work files, and the output file are all located in the same folder and with similar file names.
All of the file names start with /home/daniel/Desktop/LQfiles/dbm678
This code ...
Code:
Path=$(cut -d'.' -f1 <<< ${0})
... produces this desirable result ...
Code:
/home/daniel/Desktop/LQfiles/dbm678
... but you could hard code it thusly ...
Code:
Path="/home/daniel/Desktop/LQfiles/dbm678"
The output file is /home/daniel/Desktop/LQfiles/dbm678out.txt

The input files are ...
Code:
/home/daniel/Desktop/LQfiles/dbm678inp1.txt
/home/daniel/Desktop/LQfiles/dbm678inp2.txt
/home/daniel/Desktop/LQfiles/dbm678inp3.txt
/home/daniel/Desktop/LQfiles/dbm678inp4.txt
/home/daniel/Desktop/LQfiles/dbm678inp5.txt
... and the corresponding work files are ...
Code:
/home/daniel/Desktop/LQfiles/dbm678w1.txt
/home/daniel/Desktop/LQfiles/dbm678w2.txt
/home/daniel/Desktop/LQfiles/dbm678w3.txt
/home/daniel/Desktop/LQfiles/dbm678w4.txt
/home/daniel/Desktop/LQfiles/dbm678w5.txt
The OP would have to substitute appropriate file identifiers for his computer.
They might be of the form ...
Code:
/home/cheah/What/Ever/dbm678.bin
 ... and ...
/home/cheah/What/Ever/dbm678inp1.txt
 ... and ...
/home/cheah/What/Ever/dbm678w1.txt
 ... and ...
/home/cheah/What/Ever/dbm678out.txt
If there are 12 input files he would need input file identifiers numbered 1 through 12, and corresponding work files numbered 1 through 12.

Daniel B. Martin

Last edited by danielbmartin; 03-16-2013 at 10:19 AM. Reason: Clarification
 
Old 03-16-2013, 01:28 PM   #21
whizje
Member
 
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 594

Rep: Reputation: 141Reputation: 141
Code:
Path=$(cut -d'.' -f1 <<< ${0})
alternative
Path=$(readlink -f $0)
 
1 members found this post helpful.
Old 03-16-2013, 01:35 PM   #22
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,881

Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
Quote:
Originally Posted by whizje View Post
Code:
Path=$(cut -d'.' -f1 <<< ${0})
alternative
Path=$(readlink -f $0)
Your suggested alternative is not equivalent.
However, this is ...
Code:
Path=$(readlink -f $0 | cut -d'.' -f1)
... and I will use it henceforth.

Perhaps this change is the only obstacle preventing OP from using my program.

Daniel B. Martin
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Join Linux Server With Multiple Domains ? prayingtosky Linux - Newbie 1 01-13-2011 08:05 PM
[SOLVED] Viewing Multiple Files with the less command Hi_This_is_Dev Linux - General 3 04-14-2010 05:02 PM
Command to join text files with headers chips11 Linux - Newbie 3 11-19-2008 03:43 PM
Unable to join domain using Net Join command in FC3 client jeb083079 Linux - Networking 9 07-30-2007 02:41 AM
join multiple files onewhoknows Linux - Software 10 06-01-2004 06:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration