Author Topic: shell script default path  (Read 311 times)

Offline adizero

  • Member
  • **
  • Posts: 259
shell script default path
« on: August 26, 2016, 10:32:29 AM »

mga bro

Using Ubuntu 12

sa  #!/bin/sh   script,   san ba ang default path ng mga output file

let say hindi namin specify ang complete path na titignan nya ung sendme.txt ?   

from below minsan nag eerror minsan gumanaga.  kailngan ba tlga ilagay parti ang complete path ?  /home/user1/sendme.txt   ng     " <   /home/user1/sendme.txt"     hindi ba pwede  maging stable ang < sendme.txt

same also pag nagout kami ng logs    > log<date>.txt    next day meron new log<date>.txt     san ang magigign default directory ?

ang solution lang ba is either  complete path or  declare  home=/home/user1/     then $home/sendme.txt    ?

ang default ba  kung saan nagrun ang script ?  let say /usr/local/bin   or /home/user1 ?

what if nagrun ung script thru  /etc/cron.d ?  san ang default output file location  ?


Example :   /home/user1/sendme.txt

/usr/local/bin/mailsend.sh
#!/bin/sh
mutt -s "$SUBJECT  " test@test.com < sendme.txt

Online jeremypv

  • Member
  • **
  • Posts: 914
    • jeremypv.net
Re: shell script default path
« Reply #1 on: August 26, 2016, 09:52:52 PM »
jeremypv

Offline borgy_t

  • Member
  • **
  • Posts: 2016
  • challenge accepted
Re: shell script default path
« Reply #2 on: September 04, 2016, 11:02:49 PM »
Same directory ng script
Intel Core i5-4440 w/ Deepcool Ice Edge Mini FS 2.0 | Asus B85M-G | Zotac Geforce GTX960 2GB (128-bit) | G-Skill Ripjaws 16GB DDR3 1600 | Samsung 850 EVO 500GB | Mushkin Reactor 1TB | Dell U2311H | 550W HEC Winpower PSU | Antec 300 | SteelSeries Rival 300 | SteelSeries Apex M500 (Cherry MX Blue)

Offline adizero

  • Member
  • **
  • Posts: 259
Re: shell script default path
« Reply #3 on: September 05, 2016, 07:53:28 PM »

Thanks borgy_t    jeremypv