Skip to content

Instantly share code, notes, and snippets.

View loichu's full-sized avatar

Loic Humbert loichu

  • 42 Lausanne
View GitHub Profile
/**
* @file pipex.c
* @author @os-moussao
* @brief Implementing pipex project using a tree representation of the pipes
* @features input-output redirections, heredoc, supports multiple pipes
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
@JTBrinkmann
JTBrinkmann / destruct-alternatives.sh
Last active June 24, 2024 23:13
bash destructuring assignment for arrays
#!/bin/bash
## Alternative Versions
# only allows space separated variable name list
# example: destruct a b c = arr
destruct() {
for ((i=1;i < $#-1; ++i)) do
local value_adress="${!#}[$i-1]"
declare -g "${!i}=${!value_adress}"
done