The source command read and execute commands from a file. My parent.sh script source a script called child.sh. But, child.sh script can not determine It's own location developing use of $0. By default, $0 gives parent script location. How do I discover a script that is sourced at the command line can determine It's own location? My sample script:#!/bin/bash
# /var/www/html/java/tasks/child.sh
_me="$0"
# I want /var/www/html/java/tasks in _currentdir
_currentdir="$_me%/*"
echo "$_currentdir"
When I run from parent.sh:source child.shORsource /var/www/html/java/tasks/child.shThe $_currentdir is set to be the directory where parent.sh lives which is in /root/scripts/java/helper or . (current) directory. How do I fix this problem? See More..
วันอังคารที่ 15 พฤษภาคม พ.ศ. 2555
บทความที่ได้รับความนิยม
-
Dell ได้เปิดตัว Alienware Aurora R4 โดย Alienware new Aurora นี้ได้ดีไซน์หน้าตาเคสออกมาได้อย่างดุดันเช่นเคย ใช้ CPU Core i7 X79 Express ch...
-
การร่วมมือระหว่าง Samsung และ Intel ก่อให้เกิดระบบปฏิบัติการตัวใหม่ที่มีชื่อว่า Tizen ซึ่งเป็นที่คุ้นหูกันได้พักหนึ่ง เป็นการผสมผสานความลงตั...
-
วันนี้มีอีกหนึ่งเจ้าจากประเทศจีนที่ลงมาเล่นในตลาดนี้ด้วยในชื่อ AllWinner A10 (ชื่อเดียวกับซีพียู) สเปคที่ให้มานั้นคือซีพียู ARM (น่าจะเป็น C...
-
iPad 3 เห็นข่าวแล้วอย่าเพิ่งตกใจหรือตื่นเต้นเกี่ยวกับ iPad 3 มากเกินไป เพราะล่าสุดที่ DigiTimes ได้ ออกมาให้ข้อมูลว่า iPad 3 อาจจะเปิดตัวในช...
-
The source command read and execute commands from a file. My parent.sh script source a script called child.sh. But, child.sh script can not...
-
ล่าสุด Asus ได้ปล่อยโน้ตบุ๊ก U24E สุดบางเบา แต่ยังคงประสิทธิภาพความแรงอยู่ โดยเป็นขนาดหน้าจอ 11.6 นิ้ว ความละเอียดหน้าจอ 1366 x 768 พิกเซล ใ...
-
แม่เหล็กสามารถทำให้แบคทีเรียกลายเป็นคอมพิวเตอร์ชีวภาพได้ในอนาคตอันใกล้!! โดยรายงานฉบับนี้เป็นผลการศึกษาจากมหาวิทยาลัย UK และมหาวิทยาลัย Toky...
-
ในที่สุดก็เปิดตัว New! Ford Ranger รุ่นปี 2012 รถยนต์กระบะสายพันธุ์แกร่งในงาน Motor Show 2011 ณ อิมแพ็คเมืองทองธานีอย่างเป็นทางการแล้วนะครับ...
-
แน่นอนละครับ นี่ก็ปลายปีกันแล้วนะครับ วงการซีพียูก็มีการเปลี่ยนแปลงมากมายไม่ว่าจะเป็น Intel ที่มีการส่ง Sandy Bridge E ออกมาใหม่ และทาง AMD ...
-
ASUS Zenbook รุ่น UX31E โดดเด่นด้วยระบบเสียงอันทรงพลังของโซนิก มาสเตอร์ (Sonic Master) สวยงามด้วยรูปลักษณ์ที่บางเฉียบ ทนทานด้วยพื้นผิวโลหะอล...