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
บทความที่ได้รับความนิยม
-
แม่เหล็กสามารถทำให้แบคทีเรียกลายเป็นคอมพิวเตอร์ชีวภาพได้ในอนาคตอันใกล้!! โดยรายงานฉบับนี้เป็นผลการศึกษาจากมหาวิทยาลัย UK และมหาวิทยาลัย Toky...
-
แน่นอนละครับ นี่ก็ปลายปีกันแล้วนะครับ วงการซีพียูก็มีการเปลี่ยนแปลงมากมายไม่ว่าจะเป็น Intel ที่มีการส่ง Sandy Bridge E ออกมาใหม่ และทาง AMD ...
-
iPad 3 เห็นข่าวแล้วอย่าเพิ่งตกใจหรือตื่นเต้นเกี่ยวกับ iPad 3 มากเกินไป เพราะล่าสุดที่ DigiTimes ได้ ออกมาให้ข้อมูลว่า iPad 3 อาจจะเปิดตัวในช...
-
Acer ไล่เปิดตัวมาเรื่อยจนตอนนี้ก็มากันที่สหรัฐอาหรับเอมิเรทส์กันแล้ว สำหรับเจ้าอัลตร้าบุ๊ก Acer Aspire S5 และครั้งนี้เป็นครั้งแรกที่มีการเปิ...
-
Nokia 808 PureView ถือว่าเป็นสมาร์ทโฟนอีกรุ่นที่น่าจับตามอง สำหรับสมาร์ทโฟนที่เน้นเรื่องกล้องที่ใช้เซ็นเซอร์ 41 ล้านพิกเซล ซึ่งตอนนี้มีข่าวค...
-
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...
-
ในที่สุดก็เปิดตัว New! Ford Ranger รุ่นปี 2012 รถยนต์กระบะสายพันธุ์แกร่งในงาน Motor Show 2011 ณ อิมแพ็คเมืองทองธานีอย่างเป็นทางการแล้วนะครับ...
-
ที่ประเทศสหรัฐอเมริกา บริษัท iLuv Creative Technology ได้เปิดตัว iSM524 ArtStation Pro อุปกรณ์เสริมที่เป็นลำโพงสำหรับตั้งแท็บเล็ตตระกูล Sams...
-
ข่าวลือเกี่ยวกับ Google Tablet นั้นค่อนข้างแน่นอนแล้วว่าได้ Asus เป็นผู้ผลิต ส่วนสเปคเกี่ยวกับตัว Tablet และชื่อรุ่นนั้นยังไม่เป็นที่ปรากฎแน...
-
ล่าสุดทาง Acer ยังได้หลุดสเปกของแท็บเล็ตตัวใหม่ออกมา ที่ใช้ชื่อรุ่นว่า A700 และ A701 ผ่านทางหน้าเว็บไซต์ของตน ที่ข้อแตกต่างของ 2 รุ่นนี้ก็คื...