Sponsored Content
Full Discussion: Bash beginner
Top Forums UNIX for Beginners Questions & Answers Bash beginner Post 303041598 by darklord173 on Thursday 28th of November 2019 02:14:57 PM
Old 11-28-2019
sorted it thank you, was so simple lol
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Please help. I am a beginner.

Alrigt, I need to write a shell script where it counts the number of folders and files and dispays "My home directory has 'x' files and 'y' directories." So, I was thinking of doing this. set x = `ls | wc` so, if I have 8 files and folders in my home directory, x is not 8. now, I was... (1 Reply)
Discussion started by: Lykathea Aflame
1 Replies

2. Programming

Beginner C

Anyone know where I can get started in C++ programming in unix? Any good free tutorials or websites to start at? I am okay in unix scripting but have never done c programming of any sort... What are the main advantages of using C++ ? (2 Replies)
Discussion started by: frustrated1
2 Replies

3. Shell Programming and Scripting

Beginner bash scripting - a few problems

Hey Guys, I am creating a bash script on my freeBSD box, the script should basically ask the user to enter a username and domain. The script will take this information and basically append alot of information to config files so the user can receive email from that domain and create a web site at... (1 Reply)
Discussion started by: traxy
1 Replies

4. Shell Programming and Scripting

Beginner looking for help

Hello, I am trying to write a script that reads names from a file called input, removes names if they have the same letter next to each other and prints the others. e.g. Colin & John would be printed Garry & Lynn would be removed My thinking is that I read in each name and... (3 Replies)
Discussion started by: colinireland
3 Replies

5. Shell Programming and Scripting

[Bash] Beginner at scripting

Hi, I'm a beginner at shell scripting, just started scripting in bash a few days ago. I want to test if the command ls *.jpg returns exit code 2, and if yes I want to execute a new command ls *.jpeg, doing a test on it... and pretty much repeat the procedure. Is this correct? #!/bin/bash... (1 Reply)
Discussion started by: Utherr
1 Replies

6. Shell Programming and Scripting

Bash Script to Ash (busybox) - Beginner

Hi All, I have a script that I wrote on a bash shell, I use it to sort files from a directory into various other directories. I have an variable set, which is an array of strings, I then check each file against the array and if it is in there the script sorts it into the correct folder. But... (5 Replies)
Discussion started by: sgtbobie
5 Replies

7. Shell Programming and Scripting

Beginner Bash Scripting Question

Hello, I am new to Linux and studying to become a Unix System Admin. I am taking a course in which I was practicing creating a bash script to ping a particular IP address. The script can be found below: #/bin/bash echo "Enter the IP address" read ip if then ping -c 1 $ip if ;... (3 Replies)
Discussion started by: shah9250
3 Replies

8. Shell Programming and Scripting

Beginner here, how to call a bash-script from python properly?

Hi everyone, i have the following script.sh: foo='lsusb | grep Webcam | cut -c16-18' sudo /home/user/public/usbreset /dev/bus/usb/001/$foo when i try to call this script from python using subprocess.call("script.sh", shell=True) it seems that only 'sudo /home/user/public/usbreset' is being... (6 Replies)
Discussion started by: hilfemir
6 Replies

9. UNIX for Beginners Questions & Answers

Beginner at bash scripting - need help with passing arguments

I at the moment, making a simple bash script, capable of setting up an workspace for me, so i don't have to do it manually.. Problem is though i can't seem to provide the bash script any argument, without running into my error checks, checking for input... Here is the code: #!/bin/bash... (7 Replies)
Discussion started by: kidi
7 Replies

10. UNIX for Beginners Questions & Answers

Beginner bash - basic shell script 'while' help...

Hi everyone, first time visitor to these forums here. Keeping a long story short I've been attempting to learn how to code in bash. I have VERY little previous experience with coding languages besides simply copying and pasting batch scripts for Windows. So, with that in mind I've followed a... (4 Replies)
Discussion started by: Meta
4 Replies
lsearch(n)						       Tcl Built-In Commands							lsearch(n)

__________________________________________________________________________________________________________________________________________________

NAME
lsearch - See if a list contains a particular element SYNOPSIS
lsearch ?options? list pattern _________________________________________________________________ DESCRIPTION
This command searches the elements of list to see if one of them matches pattern. If so, the command returns the index of the first match- ing element (unless the options -all or -inline are specified.) If not, the command returns -1. The option arguments indicates how the | elements of the list are to be matched against pattern and it must have one of the following values: -all Changes the result to be the list of all matching indices (or all matching values if -inline is specified as well.) | -ascii The list elements are to be examined as Unicode strings (the name is for backward-compatability reasons.) This option is only mean- ingful when used with -exact or -sorted. -decreasing The list elements are sorted in decreasing order. This option is only meaningful when used with -sorted. -dictionary The list elements are to be compared using dictionary-style comparisons. This option is only meaningful when used with -exact or -sorted. -exact The list element must contain exactly the same string as pattern. -glob Pattern is a glob-style pattern which is matched against each list element using the same rules as the string match command. -increasing The list elements are sorted in increasing order. This option is only meaningful when used with -sorted. -inline The matching value is returned instead of its index (or an empty string if no value matches.) If -all is also specified, then the | result of the command is the list of all values that matched. -integer The list elements are to be compared as integers. This option is only meaningful when used with -exact or -sorted. -not This negates the sense of the match, returning the index of the first non-matching value in the list. | -real The list elements are to be compared as floating-point values. This option is only meaningful when used with -exact or -sorted. -regexp Pattern is treated as a regular expression and matched against each list element using the rules described in the re_syntax refer- ence page. -sorted The list elements are in sorted order. If this option is specified, lsearch will use a more efficient searching algorithm to search list. If no other options are specified, list is assumed to be sorted in increasing order, and to contain ASCII strings. This option is mutually exclusive with -glob and -regexp, and is treated exactly like -exact when either -all, or -not is specified. -start index The list is searched starting at position index. If index has the value end, it refers to the last element in the list, and | end-integer refers to the last element in the list minus the specified integer offset. If option is omitted then it defaults to -glob. If more than one of -exact, -glob, -regexp, and -sorted is specified, whichever option is specified last takes precedence. If more than one of -ascii, -dictionary, -integer and -real is specified, the option specified last takes precedence. If more than one of -increasing and -decreasing is specified, the option specified last takes precedence. EXAMPLES
| lsearch {a b c d e} c => 2 | lsearch -all {a b c a b c} c => 2 5 | lsearch -inline {a20 b35 c47} b* => b35 | lsearch -inline -not {a20 b35 c47} b* => a20 | lsearch -all -inline -not {a20 b35 c47} b* => a20 c47 | lsearch -all -not {a20 b35 c47} b* => 0 2 | lsearch -start 3 {a b c a b c} c => 5 | SEE ALSO
foreach(n), list(n), lappend(n), lindex(n), linsert(n), llength(n), lset(n), lsort(n), lrange(n), lreplace(n) | KEYWORDS
list, match, pattern, regular expression, search, string Tcl 8.4 lsearch(n)
All times are GMT -4. The time now is 03:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy