LinuxQuestions.org
Help answer threads with 0 replies.
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 04-30-2016, 10:43 PM   #1
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311
Blog Entries: 2

Rep: Reputation: 16
Post paragraph-space.sh program hangs indefinitely (ABS, 10)


Advanced Bash Scripting (ABS), Mendel Cooper
Ch 10
Example 10-1. Inserting a blank line between paragraphs in a text file
http://www.tldp.org/LDP/abs/html/str...ipulation.html

I run this program and it just hangs. Before I ran the program I executed:
Code:
$ sudo chmod +x e10-01BlankLineInsertB.sh 
[sudo] password for a: 
$ bash -xv
$ ./e10-01BlankLineInsertB.sh text.txt
./e10-01BlankLineInsertB.sh text.txt
+ ./e10-01BlankLineInsertB.sh text.txt

(program hangs here)
^C
$ ls -l e10-01BlankLineInsert* text*
ls -l e10-01BlankLineInsert* text*
+ ls -F --color=auto -l e10-01BlankLineInsertB.sh e10-01BlankLineInsert.sh text.txt text.txt.bak
-rwxrwxr-x 1 a a 1074  5月  1 11:06 e10-01BlankLineInsertB.sh*
-rwxrwxr-x 1 a a 1092  5月  1 00:02 e10-01BlankLineInsert.sh*
-rw-rw-r-- 1 a a 5402  5月  1 10:34 text.txt
-rw-rw-r-- 1 a a 5401  4月 30 23:50 text.txt.bak
The text.txt file is attached.

Is there anything I can do to get it to work?
Attached Files
File Type: txt text.txt (5.3 KB, 10 views)

Last edited by andrew.comly; 04-30-2016 at 10:47 PM. Reason: accuracy
 
Old 05-01-2016, 03:31 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
Go back and read the instructions at the top of the script on how to run it.
 
1 members found this post helpful.
Old 05-01-2016, 07:41 AM   #3
andrew.comly
Member
 
Registered: Dec 2012
Distribution: Trisquel-Mini 7.0, Lubuntu 14.04, Debian lxde 8.0
Posts: 311

Original Poster
Blog Entries: 2

Rep: Reputation: 16
Talking [solved]

Quote:
Originally Posted by grail View Post
instructions at the top of the script on how to run it.
Great advice, Thanks!

Additionally I found the concept of "<filename" in the text, unfortunately it was located in Chapter 20 I/O Redirection, and I'm only on Ch10. The specific passage:
Quote:
0< FILENAME
< FILENAME
# Accept input from a file.
# Companion command to ">", and often used in combination with it.
#
# grep search-word <filename
Another difficulty overcome!
 
Old 05-01-2016, 09:43 AM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
You shouldn't have need to sudo to chmod a file, working in a directory owned by your user (eg in your /home/user/....) just chmod it
 
1 members found this post helpful.
  


Reply

Tags
length, line, loop, text processing, variables



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
[SOLVED] Booting hangs indefinitely in "Mounting local filesystems non-root" (rc.S) Divel Slackware 9 04-09-2013 02:54 PM
Ping command hangs indefinitely i.e.system(ping -w 10 [ip address]) Anshu Tomar Linux - Newbie 4 07-05-2012 07:16 AM
Dpkg hangs indefinitely wriswith Linux - Server 4 12-20-2011 02:16 AM
abs error: core.abs.tar.gz no such file or directory Thaidog Arch 1 06-14-2011 10:20 PM
Server randomly hangs indefinitely bdb4269 Linux - General 2 03-07-2008 01:24 PM

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

All times are GMT -5. The time now is 06:23 PM.

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