advanced linux usage
play

Advanced Linux Usage 2017-10-24 Martin Dahl - PowerPoint PPT Presentation

Advanced Linux Usage 2017-10-24 Martin Dahl martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@icm.uu.se Shell and Bash the Shell is a Command Line Interface (CLI) Bash is one particular shell tcsh, zsh are also shell


  1. Advanced Linux Usage 2017-10-24 Martin Dahlö martin.dahlo@scilifelab.uu.se Valentin Georgiev valentin.georgiev@icm.uu.se

  2. Shell and Bash the Shell is a Command Line Interface (CLI) Bash is one particular shell tcsh, zsh are also shell programs

  3. Multiple files ● Same program, many files

  4. Multiple files ● Same program, many files

  5. Multiple files ● Same program, many files

  6. Multiple files ● Same program, many files

  7. Multiple files ● Same program, many files ○ 10 files? Ok ○ 1000 files? Not ok..

  8. Multiple files ● Same program, many files ○ 10 files? Ok ○ 1000 files? Not ok.. ● Reproducibility ○ Self and others

  9. Multiple files ● Same program, many files ○ 10 files? Ok ○ 1000 files? Not ok.. ● Reproducibility ○ Self and others The answer - write a script!

  10. Basic script

  11. Basic script

  12. Basic script

  13. Basic script

  14. Basic script

  15. Basic script

  16. Basic script

  17. Variables ● Assigning my_variable=5 my_variable=”nice text”

  18. Variables ● Assigning my_variable=5 my_variable=”nice text” ● Using $my_variable

  19. Variables ● Assigning my_variable=5 my_variable=”nice text” ● Using $my_variable $ my_variable=”Pia”

  20. Variables ● Assigning my_variable=5 my_variable=”nice text” ● Using $my_variable $ my_variable=”Pia” $ echo “Hello, $my_variable! ”

  21. Variables ● Assigning my_variable=5 my_variable=”nice text” ● Using $my_variable $ my_variable=”Pia” $ echo “Hello, $my_variable! ” Hello, Pia!

  22. Variables

  23. Variables

  24. Variables

  25. Variables

  26. Loops for variable in 1 2 3; do echo $variable done

  27. Loops for variable in text works too; do echo $variable done

  28. Loops for variable in mix them 5; do echo $variable done

  29. Loops

  30. Loops

  31. Loops

  32. Loop over files

  33. Loop over files

  34. Loop over files

  35. Loop over files

  36. Loop over files

  37. Loop over files

  38. Loop over files

  39. Loop over files

  40. Loop over files

  41. Loop over files

  42. If ● Control statement if true; then echo ”This is true” fi

  43. If ● Control statement if false; then echo ”This is true” fi

  44. If ● Control statement if [[ 5 < 9 ]]; then echo ”This is true” fi

  45. If ● Control statement if [[ 5 > 9 ]]; then echo ”This is true” fi

  46. If ● Control statement if [[ 5 == 9 ]]; then echo ”This is true” fi

  47. If ● Control statement if [[ ”Hello” == ”Hello” ]]; then echo ”This is true” fi

  48. If ● Control statement if [[ ”Hello” == ”Hi” ]]; then echo ”This is true” fi

  49. If ● Control statement if [[ ”Hello” == ”Hel”* ]]; then echo ”This is true” fi

  50. If ● For all samples except dog

  51. If ● For all samples except dog

  52. If ● For all samples except dog Ex: $file is /path/to/dog_1.bam

  53. If ● For all samples except dog Ex: $file is /path/to/dog_1.bam basename $file

  54. If ● For all samples except dog Ex: $file is /path/to/dog_1.bam basename $file dog_1.bam

  55. If ● For all samples except dog Ex: $file is /path/to/dog_1.bam basename $file dog_1.bam

  56. If ● For all samples except dog Ex: $file is /path/to/dog_1.bam basename $file dog_1.bam

  57. Different languages ● Programming is programming ○ Perl, Python, Bash, and more

  58. Different languages ● Programming is programming ○ Perl, Python, Bash , and more

  59. Different languages ● Programming is programming ○ Perl , Python, Bash, and more

  60. Different languages ● Programming is programming ○ Perl, Python , Bash, and more

  61. Different languages ● Programming is programming ○ Perl, Python, Bash, and more ● Start with one, git gud , (learn another)

  62. Different languages ● Programming is programming ○ Perl, Python, Bash, and more ● Start with one, git gud , (learn another) PYTHON

  63. Laboratory time! (yet again)

Recommend


More recommend