2

Look at the following lines of code:

. $IPKG_INSTROOT/etc/functions.sh

initscript=$1

action=${2:-help}

shift 2

What does the action command do?

Indrek
  • 24,424
Akshaa
  • 23

1 Answers1

2

Action is setting it's value to second argument of the script. If second argument is missing then it's set to "help".

Valor
  • 501
  • What would be the output of 'help'? Will it open some kind of help file which is already present? – Akshaa Oct 08 '12 at 06:28
  • It depends on the rest of the code, paste the missing code. If have to guess, this is an init script that have a special action "help" that show usage, and with that line there instead of dying and showing usage help, it just set it to 'help' and let the code proceed, which will produce same result. But without code, that's just a random guess. – Valor Oct 08 '12 at 06:34
  • sorry dude, the code is confidential. But, yeah..I got it. Thanks :) – Akshaa Oct 08 '12 at 06:47