Sponsored Content
Full Discussion: If and Loops
Homework and Emergencies Homework & Coursework Questions If and Loops Post 302878686 by Pcarson on Sunday 8th of December 2013 01:39:32 AM
Old 12-08-2013
If and Loops

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:
In this script you will take a directory as input from the user and change the end of line sequence from a Unix EOL sequence to a DOS style EOL sequence for each file with a ".txt" file extension in the given directory.
Create a script that will take input from the user to get a valid directory. Validations must be performed on the input and must be loop driven and only allow exit on a valid response.
Make the script loop over the directory and on all files ending in ".txt" change the end of line sequence to a DOS style end of line sequence.
This script must use, at a minimum, one if statement and one loop.


2. Relevant commands, code, scripts, algorithms:



3. The attempts at a solution (include all code and scripts):



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):Victor Valley College, Victorville, Ca, USA CIS90 Professor Thomas


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

loops?

hello....very new user to unix...and i have a question..i am not sure if there is such a thing For example...the user is asked if he likes Bananas....if he says yes.... echo You like Bananas $name at the end of the script it echos all that the user has entered so they can read it.... but... (1 Reply)
Discussion started by: jonas27
1 Replies

2. Shell Programming and Scripting

Loops within loops

I am running on HPUX using ksh. I have a script that uses a loop within a loop, for some reason the script seems to hang on a particuliar record. The record is fine and hits the condition in Blue. If I kill the 1st loop process the script continues on with no problem. Begin code> <Some... (8 Replies)
Discussion started by: bthomas
8 Replies

3. UNIX for Dummies Questions & Answers

While Loops

I'm trying to create a loop that will prompt the user for 15 values, not forcing them to enter all 15. If the user enters through one or more of the prompts the null value needs to be converted to 0, otherwise set the parameter = to the value entered: ex. Please enter file no #1: 17920 ... (4 Replies)
Discussion started by: vdc
4 Replies

4. UNIX for Dummies Questions & Answers

two loops

Hi, how can I use "for" to have two loops : this is my script : for i in (A B C) do for j in (a b c) do echo $i$j done done #End I want to print out Aa Ab Ac .... But I have error message : syntax error at line 1 : `(' unexpected Many thanks before. How should I use "for" ?? (2 Replies)
Discussion started by: big123456
2 Replies

5. Shell Programming and Scripting

while loops

Hi I've a file like so: Now, I want to read my file and take ex. the Media ID and the Type for each groups of Media (Media1,Media2,...,Media(n): cat /tmp/file|\ while read FILE do while $(FILE|cut -d: -f1)=Media$i do #here will be some test, ex: #if Media ID < 23 ... (4 Replies)
Discussion started by: nymus7
4 Replies

6. UNIX for Dummies Questions & Answers

Help with While Loops

I am traversing down a list, and I am not quite sure how to tell the loop to break when it's done going through the file. #!/bin/sh while : do read list <&3 echo $list done is the code. The file "list" is simply 5 4 3 2 1 any advice on how to break the loop after the file is... (1 Reply)
Discussion started by: MaestroRage
1 Replies

7. Shell Programming and Scripting

Help with the 2 for loops

#!/bin/bash IFS=$'\n' A= a c b t g j i e d B= t y u i o p counter=0 found="" for i in $(cat $A) do for j in $(cat $B) do if then found="yes" fi done if then (1 Reply)
Discussion started by: vadharah
1 Replies

8. Shell Programming and Scripting

Loops

Hi All, I want to execute a script the number of times a user enters. Please can you advise on hor can I do the same. Many Thanks, Shazin (4 Replies)
Discussion started by: Shazin
4 Replies

9. UNIX for Dummies Questions & Answers

loops with tr

Hello, I'm not sure if this is more appropriate for the 'unix for dummies' or the 'unix for experts' forum because I'm new to this forum and this is the second topic I've discussed, but if you could let me know which one was more appropriate for something like this, please do! So in tr (an... (2 Replies)
Discussion started by: juliette salexa
2 Replies

10. UNIX for Dummies Questions & Answers

Need help with for loops

Why wont my for statements work? Im trying to get this script to swich to a user an if you put in a start/stop/or restart paramater to do just that for each user. I commented out the actual start/stop actions to test it just by using echos and not do anything hasty in the environment but it... (0 Replies)
Discussion started by: LilyClaro
0 Replies
__gnu_parallel::find_first_of_selector< ForwardIterator >(3cxx) 		   __gnu_parallel::find_first_of_selector< ForwardIterator >(3cxx)

NAME
__gnu_parallel::find_first_of_selector< ForwardIterator > - SYNOPSIS
Inherits __gnu_parallel::generic_find_selector. Public Member Functions find_first_of_selector (ForwardIterator begin, ForwardIterator end) template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename Pred > bool operator() (RandomAccessIterator1 i1, RandomAccessIterator2 i2, Pred pred) template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename Pred > std::pair < RandomAccessIterator1, RandomAccessIterator2 > sequential_algorithm (RandomAccessIterator1 begin1, RandomAccessIterator1 end1, RandomAccessIterator2 begin2, Pred pred)" Public Attributes ForwardIterator begin ForwardIterator end Detailed Description template<typename ForwardIterator>struct __gnu_parallel::find_first_of_selector< ForwardIterator > Test predicate on several elements. Definition at line 152 of file find_selectors.h. Member Function Documentation template<typename ForwardIterator > template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename Pred > bool __gnu_parallel::find_first_of_selector< ForwardIterator >::operator() (RandomAccessIterator1i1, RandomAccessIterator2i2, Predpred) [inline] Test on one position. Parameters: i1 Iterator on first sequence. i2 Iterator on second sequence (unused). pred Find predicate. Definition at line 167 of file find_selectors.h. template<typename ForwardIterator > template<typename RandomAccessIterator1 , typename RandomAccessIterator2 , typename Pred > std::pair<RandomAccessIterator1, RandomAccessIterator2> __gnu_parallel::find_first_of_selector< ForwardIterator >::sequential_algorithm (RandomAccessIterator1begin1, RandomAccessIterator1end1, RandomAccessIterator2begin2, Predpred) [inline] Corresponding sequential algorithm on a sequence. Parameters: begin1 Begin iterator of first sequence. end1 End iterator of first sequence. begin2 Begin iterator of second sequence. pred Find predicate. Definition at line 184 of file find_selectors.h. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Thu Aug 2 2012 __gnu_parallel::find_first_of_selector< ForwardIterator >(3cxx)
All times are GMT -4. The time now is 10:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy