script-examples/__relpipe_in_filesystem_script_inode
branchv_0
changeset 29 6f15f18d2abf
parent 28 9172bd97ae99
child 30 56409232e1a1
equal deleted inserted replaced
28:9172bd97ae99 29:6f15f18d2abf
     1 #!/bin/bash
       
     2 
       
     3 # Relational pipes
       
     4 # Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info)
       
     5 #
       
     6 # This program is free software: you can redistribute it and/or modify
       
     7 # it under the terms of the GNU General Public License as published by
       
     8 # the Free Software Foundation, version 3 of the License.
       
     9 #
       
    10 # This program is distributed in the hope that it will be useful,
       
    11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
       
    13 # GNU General Public License for more details.
       
    14 #
       
    15 # You should have received a copy of the GNU General Public License
       
    16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
       
    17 
       
    18 
       
    19 # returns the inode number of given file
       
    20 # not very useful – just a demo returning an integer attribute
       
    21 
       
    22 if [[ $# == 0 ]]; then
       
    23 	echo "1";
       
    24 	echo "integer";
       
    25 elif [[ -f "$1" || -d "$1" ]]; then
       
    26 	ls -d -i "$1" | cut -d' ' -f1 | tr -d '\n';
       
    27 else
       
    28 	exit 40;
       
    29 fi