Sponsored Content
Top Forums Shell Programming and Scripting Implementing linked list in shell scripting Post 302994946 by jim mcnamara on Wednesday 29th of March 2017 09:37:54 PM
Old 03-29-2017
bash already supports associative arrays, so IMO the need for linked lists may not be all that critical. Chubler XL gave a really good take on it.
Associative arrays require bash v4
Code:
 declare -A arr=( [start]=foo [foo]=bar [bar]=quux [quux]=grault [grault]=end [end]=end )
 key=start
 while [ $key != "end" ]
 do 
    echo "$key  ${arr[$key]}"
    key=${arr[$key]}
 done


Last edited by jim mcnamara; 03-29-2017 at 10:56 PM..
These 3 Users Gave Thanks to jim mcnamara For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

Reverse single linked list

Can any one help me in reversing the single linked list and at the same time i want to print the reversed links. (2 Replies)
Discussion started by: dhanamurthy
2 Replies

2. UNIX for Dummies Questions & Answers

List linked files

A perl script that displays the list of files which have multiple links..! ls -l shows number of links in a field. (0 Replies)
Discussion started by: aadi_uni
0 Replies

3. Shell Programming and Scripting

Shell Scripting Reading List

Hello Everyone, Over the last few months I have begun to expand my programing skills from windows, Java and SQL / PL-SQL programing into the wonderful world of shell scripting. With little training budget my only options for training are books, Internet and this site (BTY... (1 Reply)
Discussion started by: caddis
1 Replies

4. Programming

I need C++ Code for single linked list

I need C++ Code for single linked list With operations as 1)insert at any position 2)delete any 3)change the data of any position (2 Replies)
Discussion started by: girija
2 Replies

5. Programming

Help with linked list in C

i have this code typedef struct client_list { char *client_name; struct client_list * next; int client_socket_fd; } client; client *current, *head; head = NULL; char *h="test"; add_client(current, h, head, &client_socket_fd); ... (24 Replies)
Discussion started by: omega666
24 Replies

6. Programming

How to check if something exists in linked list in C?

i have a linked list set up like typedef struct client_list { char *client_name; int client_socket_fd; struct client_list *next; } client; client *client_list=NULL; before adding to the list i check if it already exists, only if it does not then i add if (client_list==NULL... (1 Reply)
Discussion started by: omega666
1 Replies

7. UNIX for Advanced & Expert Users

Unix linked-list placement

Hi, I am programming in kernel, and I want to use a double linked list that holds infos that every process could access and modify THIS list. So, I suppose it is a 'global' variable since every process(thread) can reach it, I am wondering where to put it? by changing some of the kernel files? (1 Reply)
Discussion started by: louisTan
1 Replies

8. Programming

Help with linked list.

#include<stdio.h> #include<stdlib.h> struct LinkedList { int val; struct LinkedList *next; }node; /*Creating a structure variable*/ typedef struct LinkedList Node; Node *start = NULL; int create(int i) { Node *temp = NULL; if (start == NULL) ... (5 Replies)
Discussion started by: prinsh
5 Replies

9. Programming

How to delete the last node in a linked list.?

How to delete the last node in a single linked list given only the pointer to last node ? Head node will not be given. (5 Replies)
Discussion started by: VSSajjan
5 Replies

10. Programming

How to reverse a linked list by traversing only once.?

Program to reverse a linked list by traversing only once. (1 Reply)
Discussion started by: VSSajjan
1 Replies
STREAM_CONTEXT_CREATE(3)						 1						  STREAM_CONTEXT_CREATE(3)

stream_context_create - Creates a stream context

SYNOPSIS
resource stream_context_create ([array $options], [array $params]) DESCRIPTION
Creates and returns a stream context with any options supplied in $options preset. PARAMETERS
o $options - Must be an associative array of associative arrays in the format $arr['wrapper']['option'] = $value. Default to an empty array. o $params - Must be an associative array in the format $arr['parameter'] = $value. Refer to context parameters for a listing of standard stream parameters. RETURN VALUES
A stream context resource. CHANGELOG
+--------+---------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------+ | 5.3.0 | | | | | | | Added the optional $params argument. | | | | +--------+---------------------------------------+ EXAMPLES
Example #1 Using stream_context_create(3) <?php $opts = array( 'http'=>array( 'method'=>"GET", 'header'=>"Accept-language: en " . "Cookie: foo=bar " ) ); $context = stream_context_create($opts); /* Sends an http request to www.example.com with additional headers shown above */ $fp = fopen('http://www.example.com', 'r', false, $context); fpassthru($fp); fclose($fp); ?> SEE ALSO
stream_context_set_option(3), Listing of supported wrappers ("Supported Protocols and Wrappers"), Context options ("Context options and parameters"). PHP Documentation Group STREAM_CONTEXT_CREATE(3)
All times are GMT -4. The time now is 01:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy