Announcement

Collapse
No announcement yet.

Need Some Help

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Need Some Help

    Well Im Wondering is it posible to do the following in bash

    put commands in say sctions

    eg

    Code:
    #define the sections
    
    [section1]
    cd /
    do some stuff 
    do some more stuff
    
    [section2]
    cd /usr
    do some stuff
    do some stuff
    
    #start your normal scrit
    
    do some stuff
    do some stuff
    cd /
    ls
    
    call section 1 and run the commands within
    
    cd /
    do some stuff
    do some more stuff
    
    do some more normal script stuff
    cd /home/blabla
    mkdir somedir
    
    call setion 2 and run the comands within
    cd /usr
    do some stuff
    do some stuff
    
    exit the scritp
    or am i barking up the wrong tree?
    Tutorials:
    Yoda's ownCloud Installation on Kubuntu 20.04

    #2
    You can define functions. E.g.:

    Code:
    do_stuff_1() {
    konsole --hold \
    --geometry 1200x900+0+0 \
    -e /bin/bash -c "$*;$SHELL"
    }
    So every time you call do_stuff1 it runs whatever is between the { }.

    Comment


      #3
      Thanks for your help
      Tutorials:
      Yoda's ownCloud Installation on Kubuntu 20.04

      Comment

      Working...
      X